Message337085
| Author | steven.daprano |
|---|---|
| Recipients | Hameer Abbasi, steven.daprano |
| Date | 2019-03-04.09:17:57 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1551691077.2.0.110238024185.issue36178@roundup.psfhosted.org> |
| In-reply-to |
| Content | |
|---|---|
Your metaclass.__new__ method returns None instead of the new class. The rule for calling __init__ is: - if the constructor __new__ returns an instance of the type, then call the initializer __init__ - otherwise, don't call __init__ at all. https://docs.python.org/3/reference/datamodel.html#object.__new__ Since your __new__ accidentally returns None, the __init__ is not called. If you change the line to say return super().__new__(cls, *args, **kwargs) you will see that __init__ is called. (And discover the bugs in your init method :-) |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2019-03-04 09:17:57 | steven.daprano | set | recipients: + steven.daprano, Hameer Abbasi |
| 2019-03-04 09:17:57 | steven.daprano | set | messageid: <1551691077.2.0.110238024185.issue36178@roundup.psfhosted.org> |
| 2019-03-04 09:17:57 | steven.daprano | link | issue36178 messages |
| 2019-03-04 09:17:57 | steven.daprano | create | |