A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-September/009445.html below:

[Python-Dev] fileno function in file objects

[Python-Dev] fileno function in file objectsGuido van Rossum guido@beopen.com
Tue, 19 Sep 2000 09:33:02 -0500
> Section 2.1.7.9 of the library reference explains that file objects
> support a fileno method. Is that a mandatory operation on file-like
> objects (e.g. StringIO)? If so, how should it be implemented? If not,
> shouldn't the documentation declare it optional?
> 
> The same question for documented attributes: closed, mode, name,
> softspace: need file-like objects to support them?

fileno() (and isatty()) is OS specific and only works if there *is* an
underlying file number.  It should not be implemented (not even as
raising an exception) if it isn't there.

Support for softspace is needed when you expect to be printing to a
file.

The others are implementation details of the built-in file object, but
would be nice to have if they can be implemented; code that requires
them is not fully supportive of file-like objects.

Note that this (and other, similar issues) is all because Python
doesn't have a standard class hierarchy.  I expect that we'll fix all
this in Python 3000.  Until then, I guess we have to muddle forth...

BTW, did you check in test cases for all the methods you fixed?

--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4