Bernhard Herzog <bh@intevation.de> writes: > Alex Martelli <aleax@aleax.it> writes: > >> be helpful too? Meaning to use local variable <identifier> in lieu of >> the abstract _x -- for example in order to enable: >> >> with myfile = auto_closing_file('blah.txt', 'rb'): >> xx = myfile.read(23) >> # rest of suite snipped >> >> where auto_closing_file is a subclass of file defining useful __enter__ >> (empty -- might be nice to have it optional...) and __exit__ = close >> synonyms (or file itself might grow __exit__ as a synonym for close). >> >> How would I do this elegantly without the assignment...? > > Just as you do with if: Good point. "with" testlist ':' NEWLINE it is, if it's me that gets to write the PEP. Cheers, M. -- Or here's an even simpler indicator of how much C++ sucks: Print out the C++ Public Review Document. Have someone hold it about three feet above your head and then drop it. Thus you will be enlightened. -- Thant Tessman
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