Terry Reedy wrote:
> If an object without __bool__ returned itself as its length, this
> would be
> an infinite loop, at least in this Python version. Do we worry about
> something so crazy?
Doesn't len() have a requirement that __len__ return an integer? If so,
perhaps it would be better if this were:
def bool(obj):
try:
return obj.__bool__()
except AttributeError:
return len(obj) > 0
If I'm wrong (don't have the source available right now) then perhaps
len() *should* have this requirement.
Tim Delaney
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com