[docs] [issue18534] State clearly that open() 'file' param is "name" attr of the result

Nick Coghlan report at bugs.python.org
Thu Jul 25 15:02:03 CEST 2013


Nick Coghlan added the comment:

Switching this to a docs bugs, since http://docs.python.org/3/library/functions.html#open doesn't mention this behaviour at all, and http://docs.python.org/3/library/io.html#io.FileIO.name only notes the fact it may be a file descriptor without mentioning the str/bytes discrepancy.

So, at a bare minimum, we need to clearly describe this behaviour in the docs. We may also want to explicitly point out that using os.fsdecode(name) before passing it to open() will ensure that the name attribute is set to a string rather than a bytes object.

----------
assignee:  -> docs at python
components: +Documentation
nosy: +docs at python
title: File "name" attribute should always be a text string -> State clearly that open() 'file' param is "name" attr of the result
versions: +Python 3.3, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18534>
_______________________________________


More information about the docs mailing list