[Python-ideas] Pattern matching
Chris Angelico
rosuav at gmail.com
Wed Apr 8 04:04:03 CEST 2015
On Wed, Apr 8, 2015 at 7:10 AM, Andrew Barnert
<abarnert at yahoo.com.dmarc.invalid> wrote:
> The smaller problem is that in Python, only functions (and classes and modules) have scope; the idea of a name bound "locally" is tricky. There's a bit of hackery around except clauses...
>
FWIW it's not hackery around scope at all - it's simply that the name
gets unbound:
>>> e = 2.71828
>>> try: 1/0
... except ZeroDivisionError as e: print("1/0!")
...
1/0!
>>> e
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'e' is not defined
ChrisA
More information about the Python-ideas
mailing list