[issue40578] Deprecate numeric item access for platform.uname()

Jason R. Coombs report at bugs.python.org
Sat May 9 15:23:30 EDT 2020


Jason R. Coombs <jaraco at jaraco.com> added the comment:

In issue40570, Marc-Andre writes:

> I don't think that deprecating standard tuple access is an option
for the uname() return value, since it's documented to be a tuple.

My thinking here is that as part of the deprecation, the documentation would be updated to reflect the recommended and long-term supported usage (attribute access + iterability), including the recommended way to adapt if one wants a tuple. The guidance would eliminate or indicate as deprecated the index-based access. Then, by way of the DeprecationWarning, those still relying on item-access would be encouraged to update their implementation to use the preferred form. 


By doing this, `platform` goes from having 3 right ways to do something:

```
system = platform.system()
system = platfurm.uname().system
system = platform.uname()[0]
```

to just the first two.

I don't see how documenting something makes it permanent, though I acknowledge it does affect how one approaches any deprecation.

----------

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


More information about the Python-bugs-list mailing list