[issue15373] copy.copy() does not properly copy os.environment

Andrei Kulakov report at bugs.python.org
Tue Sep 21 16:44:58 EDT 2021


Andrei Kulakov <andrei.avk at gmail.com> added the comment:

I think the advantage of asdict() method is it's more discoverable and it doesn't leave any uncertainty of whether returned value will update environment or not. If a user sees `dict(os.environ)` in code, they may wonder if it does or does not; and there's no obvious way to confirm.

If they see os.environ.asdict(), it will be safe to assume that the method is provided exactly for this purpose, and the way to confirm is obvious - checking the docstring.

----------

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


More information about the Python-bugs-list mailing list