Re: [Python-Dev] Context management patterns

2013-10-19 Thread Xavier Morel
On 2013-10-19, at 08:38 , Nick Coghlan wrote: >> The above example, especially if extended beyond two files, begs to used in >> a loop, like your 5 line version: >> >> >> for name in ("somefile.tmp", "someotherfile.tmp"): >> with suppress(FileNotFoundError): >>os.remove(name

Re: [Python-Dev] Context management patterns

2013-10-19 Thread Nick Coghlan
On 19 October 2013 20:47, Glenn Linderman wrote: > Sadly, all the documentation that references "suppressing" an exception, is > misleading. Misleading enough that you convinced yourself to rename from > ignore to suppress after reading it, even though the two are nearly > synonymous. You misunde

Re: [Python-Dev] Context management patterns

2013-10-19 Thread Nick Coghlan
On 19 October 2013 20:47, Glenn Linderman wrote: > Thanks again for sharing the big picture: you have before, but I see you've > evolved it slightly. Delayed error handling I've had occasion to do, but > not yet in Python. The constrained jump pattern is interesting, but the > example is not comp

Re: [Python-Dev] Context management patterns

2013-10-19 Thread Glenn Linderman
On 10/18/2013 11:38 PM, Nick Coghlan wrote: However, that's a confusion about exception handling in general, not about the suppress context manager in particular. The same potential for conceptual confusion exists between: for name in ("somefile.tmp", "someotherfile.tmp"): try: