[Tarantool-patches] [PATCH v1 1/4] test: fix app-tap/http_client.test.lua
Sergey Bronnikov
sergeyb at tarantool.org
Thu Jan 14 15:52:06 MSK 2021
Thanks for review!
On 14.01.2021 15:23, Alexander Turenko wrote:
>> @@ -76,7 +76,7 @@ def post_handle(env, response):
>> code = "200 OK"
>> body = [env["wsgi.input"].read()]
>> headers = []
>> - for key,value in env.iteritems():
>> + for key,value in iter(env.items()):
> AFAIR, <dict>.items() forms a list on Python 2, but creates an iterator
> object on Python 3. Both are suitable for the for loop expression and
> there is no much difference when the dictionary in not large.
Generally it is so. Although PEP-0469 recommends to convert d.items() to
iter(d.iteritems()) [1].
> iter() does not change anything here (however it is harmless).
>
> .iteritems() was preferred by developers in Python 2 days, because it
> creates an iterator, but most of times we know that a dictionary is not
> large and we're okay with negligible perf. down on Python 2.
I have reverted iter() related changes to reduce a patch. Everything
works as is.
1. https://www.python.org/dev/peps/pep-0469/
More information about the Tarantool-patches
mailing list