2006/5/24, Sanghyeon Seo <[EMAIL PROTECTED]>:
>
> "For instance, if a class defines a method named __getitem__(), and x
> is an instance of this class, then x[i] is equivalent to
> x.__getitem__(i)."
>
> In this case, although x.__getitem__ exists, x is an instance of a
> class which *does not* def
When you file the doc bug, make sure that your "in this case" paragraph
mentions __nonzero__ rather than __getitem__ (assuming you use the same example
that started this, of course).
At 06:11 AM 5/24/2006, Sanghyeon Seo wrote
>2006/5/24, Sanghyeon Seo <[EMAIL PROTECTED]>:
>> Obscure. The issue i
May 24, 2006 3:12 AM
To: Discussion of IronPython
Subject: Re: [IronPython] Special method lookup
2006/5/24, Sanghyeon Seo <[EMAIL PROTECTED]>:
> Obscure. The issue is that special method lookup should only happen on
> the type, not the instance. I am not sure whether this is clearly
2006/5/24, Sanghyeon Seo <[EMAIL PROTECTED]>:
> Obscure. The issue is that special method lookup should only happen on
> the type, not the instance. I am not sure whether this is clearly
> specified...
Python Reference Manual 3.3. The wording is not the best. Should file a doc bug.
"For instance,
Obscure. The issue is that special method lookup should only happen on
the type, not the instance. I am not sure whether this is clearly
specified...
# test.py
class Strange(object):
pass
obj = Strange()
obj.__nonzero__ = lambda: False
print obj.__nonzero__()
print bool(obj)
# CPython
False