[issue32163] getattr() returns None even when default is given
Steven D'Aprano
report at bugs.python.org
Tue Nov 28 21:24:46 EST 2017
Steven D'Aprano <steve+python at pearwood.info> added the comment:
That's not a bug. That's because the file object does have an encoding attribute, which is set to None.
getattr only returns the default when the attribute doesn't exist, not if it exists but is None.
----------
nosy: +steven.daprano
resolution: -> not a bug
stage: -> resolved
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32163>
_______________________________________
More information about the Python-bugs-list
mailing list