On Tuesday 04 February 2003 06:19 pm, Duncan Booth wrote: > On 4 Feb 2003 at 17:02, Moore, Paul wrote: > > # You do realise you can't use a raw file object here really? > > Unless of course the file object sprouted an __exit__ method. Yep, just an __exit__ = close in class scope would do it, if "class file(object):" was coded in Python;-) > It's probably worth including the pro's and con's of that in > your PEP. Particularly the con's, if you can think of any. Me, I can't. > I can see people falling into the trap of expecting the file > object to 'do the obvious thing' here (Neal Norwitz being the > first, but almost certainly not the last). Indeed, why _shouldn't_ file do the obvious thing? Just like it has a __del__ = close, so should it have an __exit__ (the latter only if with IS introduced, of course). Alex
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