Jan Christoph added the comment:
Just wanted to say, I ran into this while using direnv. See the issue I opened
before knowing of this one: https://bugs.python.org/issue43038
--
nosy: +con-f-use
Added file: https://bugs.python.org/file49779/shell-session.txt
New submission from Jan Christoph :
Running
python3 -Im ensurepip --upgrade --default-pip
in a directory that contains a setup.cfg / setup.py combination, caused
ensurepip to try and use these files, leading to
distutils.errors.DistutilsOptionError: error in setup.cfg: command 'build' has
Jan Christoph added the comment:
In particular, this might conflict with the documentation of global, which
states:
> If the target is an identifier (name):
>
>If the name does not occur in a global statement in the current code
> block: the name is bound to the object in
Jan Christoph added the comment:
Just because it is documented, doesn't mean it's not a bug or illogical and
unexpected.
--
___
Python tracker
<https://bugs.python.org/issue27
Jan Christoph added the comment:
I would argue to reopen this. Seeing I and other people run into that issue
(e.g. https://stackoverflow.com/q/40883083/789308) quiet frequently.
Especially since it breaks the `global` keyword, e.g.:
__superprivate = "mahog"
class AClass(object
Jan Christoph added the comment:
Updated example with reversed variable order for reference. This really seems
to be related to issue3692, but really not the same thing.
IMHO both `a` and `b` should be passed in a situation like this:
a = range(5)
b = range(3)
c = [x+y for x in a for y
Jan Christoph added the comment:
Okay, so we're a in another scope inside the dictionary comprehension (all
comprehensions for that matter), and only one symbol is passed to the inside.
That's why `strange_reversed_working = {x+s.replace('(+/-)',''):None for x in
infts.split(', ') for s
Jan Christoph added the comment:
But the simpler dictionary compprehension `{s.replace('(+/-)',''):None for s in
infts.split(', ')}` works perfectly. Shouldn't that also give the error if it
was a scope issue?
--
___
Python tracker
<ht
New submission from Jan Christoph :
The python code:
```
class _tri(object):
infts = '(+/-)inf, (+/-)infty, (+/-)infinity'
strange_failing = {x+s.replace('(+/-)',''):None for x in ('+','-','') for s
in infts.split(', ')}
```
gives a `global name 'infts' is not defined` exception