[issue23653] Make inspect._empty test to False
Nathan West
report at bugs.python.org
Fri Jun 5 21:26:47 CEST 2015
Nathan West added the comment:
Doesn't the same issue exist for all other uses of the idiom, though?
Python provides container "truthiness" even though `len(x) == 0` is more
"correct."
On Fri, Jun 5, 2015, 3:20 PM Yury Selivanov <report at bugs.python.org> wrote:
>
> Yury Selivanov added the comment:
>
> Nathan, consider the following signature:
>
> def foo(a=0:''): pass
>
> now, sig.parameters['a'].annotation will be '' and .default will be 0, and
> they will fail 'if param.annotation or param.default' check. That's why we
> encourage checks like 'if param.annotation is not param.empty'.
>
> Closing this issue.
>
> ----------
> assignee: -> yselivanov
> nosy: +yselivanov
> resolution: -> rejected
> status: open -> closed
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <http://bugs.python.org/issue23653>
> _______________________________________
>
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23653>
_______________________________________
More information about the Python-bugs-list
mailing list