On Mar 25, 8:27 am, Andre Engels <andreeng...@gmail.com> wrote:
> On Wed, Mar 25, 2009 at 4:21 PM, andrew cooke <and...@acooke.org> wrote:
>
> > but i may be wrong - are there any containers (apart from pathological
> > hand-crafted examples) that would not define __len__()?
>
> When writing my answer, I thought of generators, but I now find that
> those will have boolean value 'true' whether or not they have
> something to generate, so they will go wrong under either method.

Yes, but notice that one of them goes wrong by raising an exception,
whereas the other goes wrong by failing silently.


Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to