Creating a new file object; open() vs file() (was: Re: altering an object as you iterate over it?)
Ben Finney
bignose+hates-spam at benfinney.id.au
Fri May 19 21:35:05 EDT 2006
John Salerno <johnjsal at NOSPAMgmail.com> writes:
> 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 that you're calling a class (in this case, type)
constructor, to return a new object. Do you find int(), dict(), set()
et al to be strange names for what they do?
--
\ "I was sleeping the other night, alone, thanks to the |
`\ exterminator." -- Emo Philips |
_o__) |
Ben Finney
More information about the Python-list
mailing list