[IronPython] Special method lookup

J. Merrill jvm_cop at spamcop.net
Thu May 25 06:54:50 CEST 2006


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 <sanxiyn at gmail.com>:
>> 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, 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* define a method named __getitem__(), so it
>should not be called.
>
>Seo Sanghyeon


J. Merrill / Analytical Software Corp





More information about the Ironpython-users mailing list