[docs] [issue32594] File object 'name' attribute inconsistent type and not obviously documented

R. David Murray report at bugs.python.org
Thu Jan 18 13:15:39 EST 2018


R. David Murray <rdmurray at bitdance.com> added the comment:

I believe you are correct that it is too late to modify the existing behavior.  Too many programs depend on it.  As far as documenting, my point is that it is *not specified* what the name attribute contains.  It can contain literally anything, depending on the particular file object involved.

Could we document what the open function actually does?  That perhaps we could do, since it is likely that other python implementations will want to copy what CPython does in this case.  But as you observe, this can also be *system dependent*, so it is not completely clear to me exactly how we should do that.  That is, the description of what actually happens could be so complex that it might be better to just say something like "The exact type and value of the name attribute is not specified, but when the file is opened via a file system path it will almost always be that path as a string.".

I'd be happy for a better answer, though :)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32594>
_______________________________________


More information about the docs mailing list