I wrote: > > class MyFile(file): > > etc > > > > I couldn't see how to have an instance of MyFile returned from the > > built-in 'open' function. I thought this was the crux of the problem.
Kent Johnson replied: > open() is actually just an alias for file(): > >>> open is file > True Thank you very much! You have just provided me with the vital piece of information I needed and everything has just clicked into place. Now that I know that I've searched the documentation again and found: The file() constructor is new in Python 2.2 and is an alias for open(). Both spellings are equivalent. The intent is for open() to continue to be preferred for use as a factory function which returns a new file object. The spelling, file is more suited to type testing (for example, writing "isinstance(f, file)"). See http://docs.python.org/lib/built-in-funcs.html#l2h-25 Cheers Duncan _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor