Proposed extension to file constructor

Jeff Epler jepler at unpythonic.net
Wed Jun 4 16:58:09 CEST 2003


On Wed, Jun 04, 2003 at 01:22:25AM -0500, Taral wrote:
> On Tue, Jun 03, 2003 at 02:47:41PM -0500, Jeff Epler wrote:
> > ... but maybe this is the natural interpretation of file(i) when
> > isinstance(i, int).
> 
> Yes, I considered this, but there were sufficiently persuasive arguments
> against in the sourceforge bug.

I'll have to read those arguments.  I'll take a look back in the thread
for the bug URL.
> 
> > ... and maybe the natural interpretation of file(f) when isinstance(f,
> > int) is file(os.dup(f.fileno())) (assuming the above file(i) behavior)
> 
> I think you meant "when isinstance(f, file)". This is possible.

Yes.

> 
> > ... and maybe the natural interpretation of file("-") is sys.stdin, and
> > file("-", "w") is sys.stdout.
> 
> Yuk. What if I want a file called "-"?

.. then you have to call it "./-".  Just like at the shell, where you
have to type "rm ./-" instead of "rm -".

Jeff





More information about the Python-list mailing list