[Python-bugs-list] [ python-Bugs-454887 ] static/classmethods and tp_slots
noreply@sourceforge.net
noreply@sourceforge.net
Fri, 24 Aug 2001 01:36:11 -0700
Bugs item #454887, was opened at 2001-08-24 01:36
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=454887&group_id=5470
Category: Type/class unification
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Roeland Rengelink (rengelink)
Assigned to: Guido van Rossum (gvanrossum)
Summary: static/classmethods and tp_slots
Initial Comment:
Consider:
>>> class D(object):
... def __iter__():return iter([1,2,3])
... __iter__ = staticmethod(__iter__)
...
>>> D.__iter__()
<iterator object at 0x814cfcc>
>>> iter(D)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: iter() of non-sequence
I can't say this is a bug, because i don't think the
behaviour of assignment of staticmethod and classmethod
objects to tp_* slots is defined. However, the
behaviour was unexpected to me. Also, if the
assignment is illegal it should probably raise an error
at class definition time.
PS I have one or two similar examples of surprising
errors that would probably just need additional docs to
explain them. Should I report these as bugs, or should
I await further releases/doc updates first?
Cheers,
Roeland
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=454887&group_id=5470