altering an object as you iterate over it?

John Salerno johnjsal at NOSPAMgmail.com
Fri May 19 16:49:26 EDT 2006


Paul McGuire wrote:

> I think it is just part of the objectification trend - "f =
> open('xyzzy.dat')" is sort of a functional/verb concept, so it has to return
> something, and its something non-objecty like a file handle - urk!  Instead,
> using "f = file('xyzzy.dat')" is more of an object construction concept 

I see what you mean, but I think that's why I like using open, because I 
like having my functions be verbs instead of nouns.

> Note though, the asymmetry of
> "f = open('blah')" and "f.close()" - there is no "close(f)".

I'm not sure that's a perfect comparison though, because the counterpart 
of close(f) would be open(f), and whether you use file() or open(), 
neither is taking f as the parameter like close() does, and you aren't 
calling close() on 'blah' above.



More information about the Python-list mailing list