Re: [Python-Dev] bool(container) [was bool(iter([])) changedbetween 2.3 and 2.4]

2005-09-30 Thread Lisandro Dalcin
On 9/30/05, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > [Guido van Rossum] > > __len__ is for sequences and mappings specifically -- everything that > > supports __getitem__ should have __len__ and everything that has > > __len__ should have __getitem__. > > That's going a bit far. Unordered co

Re: [Python-Dev] bool(container) [was bool(iter([])) changedbetween 2.3 and 2.4]

2005-09-30 Thread Fredrik Lundh
Guido van Rossum wrote: > "Containerish" behavior isn't enough to warrant empty <--> false; in > some sense every object is a container (at least every object with a > __dict__ attribute) and you sure don't want to map __len__ to > self.__dict__.__len__... the ElementTree experience shows that do

Re: [Python-Dev] bool(container) [was bool(iter([])) changedbetween 2.3 and 2.4]

2005-09-30 Thread Raymond Hettinger
[Guido van Rossum] > __len__ is for sequences and mappings specifically -- everything that > supports __getitem__ should have __len__ and everything that has > __len__ should have __getitem__. That's going a bit far. Unordered collections (like sets and bags) are a good counter-example. Raymon

Re: [Python-Dev] bool(container) [was bool(iter([])) changedbetween 2.3 and 2.4]

2005-09-30 Thread Michael Chermside
Jim Jewett writes: > Python doesn't worry about a precise boolean object, it > distinguishes between something and nothing. > > Is there anything left?" is a pretty good analogy for iterators. [...] > A Queue.Queue is always true. Should I submit a bug patch I would have phrased this very d