[Python-Dev] Re: Sets: elt in dict, lst.include

Skip Montanaro skip@mojam.com (Skip Montanaro)
2001年1月31日 09:57:30 -0600 (CST)


 Ping> x is sequence-like if it provides __getitem__() but not keys()
So why does this barf?
 >>> [].__getitem__
 Traceback (most recent call last):
 File "<stdin>", line 1, in ?
 AttributeError: __getitem__
(Obviously, lists *do* understand __getitem__ at some level. Why isn't it
exposed in the method table?)
Skip

AltStyle によって変換されたページ (->オリジナル) /