[Python-3000] Change in sys.stdin.name

Guido van Rossum guido at python.org
Thu Aug 16 02:37:19 CEST 2007


It sort of is -- the new I/O library uses the file descriptor if no
filename is given. There were no unit tests that verified the old
behavior, and I think it was of pretty marginal usefulness. Code
inspecting f.name can tell the difference by looking at its type -- if
it is an int, it's a file descriptor, if it is a string, it's a file
name.

On 8/15/07, Eric Smith <eric+python-dev at trueblade.com> wrote:
> I mentioned this in another message, but I thought I'd mention it here.
>
> I see this change in the behavior of sys.stdin.name, between 2.3.3 and
> 3.0x (checked out a few minutes ago).
>
> $ python
> Python 2.3.3 (#1, May  7 2004, 10:31:40)
> [GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> import sys
>  >>> sys.stdin.name
> '<stdin>'
>
>
> $ ./python
> Python 3.0x (py3k:57077M, Aug 15 2007, 17:27:26)
> [GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> import sys
>  >>> sys.stdin.name
> 0
>
>
> I see similar behavior with sys.stdout and sys.stderr.
>
> Is this deliberate?  I can file a bug report if need be, just let me know.
>
> Eric.
>
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe: http://mail.python.org/mailman/options/python-3000/guido%40python.org
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list