Guido van Rossum added the comment:

No time to follow this in detail, but one thing: please do not make the 
selector appear "false" under *any* circumstances. I've seen too many code 
write "if foo" where they meant "if foo is not None" and get in trouble because 
foo wasn't None but happened to have no content. (See e.g. recent issue 19097, 
although the situation there is even more complicated.) (And for things 
formally deriving from Container it's a different thing. But that shouldn't be 
done lightly.)

I think it's useful to be able to get the keys; it would be nice if that was an 
O(1) operation so you can also check for emptiness without needing a second 
method. Perhaps the method shouldn't be called keys() to avoid any confusion 
with subclasses of the Container ABC?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19172>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to