Feature or enhancement
Proposal:
Currently, if you cast an empty list iterator (iter([])) to a bool, you get True
This is opposed to casting an empty list ([]) to a bool, where you get the much more reasonable result of False
I propose properly implementing boolean conversion for list_iterator, to prevent potentially confusing and unintuitive bugs.
I had a bit of a look under the hood, and I believe implementing tp_as_sequence in the _PyListIterObject class in /Include/internal/pycore_list.h on lines 69-73 would resolve this issue.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Feature or enhancement
Proposal:
Currently, if you cast an empty list iterator (
iter([])) to abool, you getTrueThis is opposed to casting an empty list (
[]) to abool, where you get the much more reasonable result ofFalseI propose properly implementing boolean conversion for list_iterator, to prevent potentially confusing and unintuitive bugs.
I had a bit of a look under the hood, and I believe implementing
tp_as_sequencein the_PyListIterObjectclass in /Include/internal/pycore_list.h on lines 69-73 would resolve this issue.Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response