2010/12/17 Stefan Behnel <stefan_ml at behnel.de>: > Hi, > > it seems that Py3 doesn't support setting a "nonlocal" value as part of the > "nonlocal" command > > Python 3.2a4+ (py3k:86480, Nov 16 2010, 16:43:22) > [GCC 4.4.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> def x(): > ... y = 5 > ... def f(): > ... nonlocal y = 6 > File "<stdin>", line 4 > nonlocal y = 6 > ^ > SyntaxError: invalid syntax > > even though the PEP clearly describes this feature. > > http://www.python.org/dev/peps/pep-3104/#proposed-solution > > Either the PEP or the implementation should be updated. Personally, I think > the PEP should be changed as I think that the syntax complicates the grammar > more than it's worth. Also, the moratorium applies here, given that Py3.1 > does not implement this. > > Comments? There's a issue and a patch for this somewhere. I personally don't care; it's not too painful to write two lines. -- Regards, Benjamin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4