Message210141
| Author |
Gerrit.Holl |
| Recipients |
Gerrit.Holl |
| Date |
2014年02月03日.15:36:42 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1391441802.61.0.557224247712.issue20503@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
When using an abstract base class, super(type, obj) throws a TypeError stating "obj must be an instance (...) of type", even though isinstance(obj, type) returns True. I'm not sure what is supposed to happen here, but either the error message and the documentation for super would need to be reformulated, or there is an issue with the implementation, or I am misunderstanding something.
Python 3.3.3 (default, Dec 12 2013, 11:13:02)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numbers
>>> super(numbers.Number, 0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: super(type, obj): obj must be an instance or subtype of type
>>> isinstance(0, numbers.Number)
True |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2014年02月03日 15:36:42 | Gerrit.Holl | set | recipients:
+ Gerrit.Holl |
| 2014年02月03日 15:36:42 | Gerrit.Holl | set | messageid: <1391441802.61.0.557224247712.issue20503@psf.upfronthosting.co.za> |
| 2014年02月03日 15:36:42 | Gerrit.Holl | link | issue20503 messages |
| 2014年02月03日 15:36:42 | Gerrit.Holl | create |
|