Unshadow list built-in in httputil.HTTPHeaders.get_all() #683

Merged
merged 2 commits into from Feb 19, 2013

Projects

None yet

2 participants

Contributor
vkosh commented Feb 18, 2013

The HTTPHeaders method code:

def get_all():
    for name, list in self._as_list.items():  # or even self._as_list.iteritems()
...

may be produced by 2to3 into:

def get_all():
    for name, list in list(self._as_list.items()):
...

which leads to error due to shadowing of "list' built-in by local variable named "list".
And I include docstrings quoting fixes in the pull request.

Owner

We no longer use 2to3 so it doesn't matter that it may produce incorrect results. However, it's still a good idea to avoid shadowing builtins as a general principle. The docstring change is also fine, but for future reference I'd prefer if you make separate pull requests for unrelated changes.

@bdarnell bdarnell merged commit 7368cfc into tornadoweb:master Feb 19, 2013

1 check passed

default The Travis build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment