Currently the class can inherit from arbitrary objects, not only types.
If the object was not designed for this you can get a mysterious
mistake, e g.:
>>> class A(1): ...
...
Traceback (most recent call last):
File "", line 1, in
TypeError: int() takes at most 2 arguments (3 given)
If the
On Sat, Mar 05, 2022 at 11:27:44AM +0200, Serhiy Storchaka wrote:
> Currently the class can inherit from arbitrary objects, not only types.
Is that intentionally supported?
I know that metaclasses do not have to be actual classes, they can be
any callable with the correct signature, but I didn
Steven D'Aprano wrote:
> On Sat, Mar 05, 2022 at 11:27:44AM +0200, Serhiy Storchaka wrote:
> > Currently the class can inherit from arbitrary objects, not only types.
> > Is that intentionally supported?
> I know that metaclasses do not have to be actual classes, they can be
> any callable with th
Good to hear from you, Serhiy. I hope you and your family are safe.
On Sat, Mar 5, 2022 at 1:29 AM Serhiy Storchaka wrote:
> Currently the class can inherit from arbitrary objects, not only types.
> If the object was not designed for this you can get a mysterious
> mistake, e g.:
>
> >>> class
On Sat, Mar 05, 2022 at 04:42:55PM -, Jason Madden wrote:
> zope.interface relies on this behaviour.
The example you give shows that Interface is a class. It merely has a
metaclass which is not `type`. (I presume that is what's going on
behind the scenes.)
I'm asking about the example that
Yes, it's supposed to work. There's tons of special code to support it, and
documentation (e.g.
https://docs.python.org/3/reference/datamodel.html?highlight=__mro_entries__#resolving-mro-entries
).
Now, I think it was an attempt at getting too fancy, but we can't remove
the functionality without d
Steven D'Aprano wrote:
> On Sat, Mar 05, 2022 at 04:42:55PM -, Jason Madden wrote:
> > zope.interface relies on this behaviour.
> > The example you give shows that Interface is a class. It merely has a
> metaclass which is not `type`. (I presume that is what's going on
> behind the scenes.)