Robert Brewer wrote: > There's a typo in the code snippets at the moment. > > The translation of the above statement is: > > abc = EXPR > exc = () # Or (None, None, None) ? > try: > try: > VAR = abc.__enter__() > BLOCK > except: > exc = sys.exc_info() > raise > finally: > abc.__exit__(exc) > > I think you meant "abc.__exit__(*exc)". Assuming that, then "exc = > (None, None, None)" makes the most sense. If exc_info() is going to be > passed as a single arg, then I'd rather have the default "exc = ()", so > I can simply check "if exc:" in the __exit__ method. Also, the call to __enter__() needs to be before the try/finally block (as it is in PEP 310). Otherwise we get the "releasing a lock you failed to acquire" problem. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://boredomandlaziness.blogspot.com
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