◐ Shell
clean mode source ↗

Message 321326 - Python tracker

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, when normal dictionary comprehensions (without nested loops) and regular nested for-loops work perfectly well.

For a complete shell session and more illustrative example in versions 2.7.15 and 3.6.4 see: https://pastebin.ubuntu.com/p/9Pg8DThbsd/