[New-bugs-announce] [issue1126] file.fileno and file.isatty() should be implementable by any file like object
Nir Soffer
report at bugs.python.org
Fri Sep 7 04:00:06 CEST 2007
New submission from Nir Soffer:
The docs (http://docs.python.org/dev/3.0/library/stdtypes.html#sequence-
types-str-bytes-list-tuple-buffer-range) warn that .fileno and .istty
should not be implemented by a file like object.
This require client to check if the file object has the attribute before
they call the method, instead of treating all files the same.
if hasattr(foo, 'istty'):
if foo.istty():
# ...
Instead of:
if foo.istty():
# ...
istty can easily return False. fileno can return invalid file descriptor
number (-1?).
----------
components: Library (Lib)
messages: 55724
nosy: nirs
severity: normal
status: open
title: file.fileno and file.isatty() should be implementable by any file like object
type: rfe
versions: Python 3.0
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1126>
__________________________________
More information about the New-bugs-announce
mailing list