Timothy Cardenas added the comment:
Ahhh i see now.
Even the simple case "class Foo(bar='baz'): pass" fails.
I misunderstood the documentation then. I thought that python 3 introduced a
new interface for all classes when it actually just introduced the option to
add keyword arguments to your
R. David Murray added the comment:
Yes, this is exactly analogous to object.__init__ not accepting arguments, but
subclasses being free to do so. ABCMeta *does* adopt the contract. keyword
arguments to the class constructor are not accepted unless you write a meta
class that accepts them. P
Yury Selivanov added the comment:
> Wouldn't it be much easier and technically correct for the core ABCMeta
> library to adopt the same interface contract for class creation introduced in
> python3?
No, it would not be technically correct. For the same reason, object.__init__
does not accept
Timothy Cardenas added the comment:
Hmm Ok. You are right i can do the following:
from collections import UserDict
from abc import ABCMeta
class MetaMyDict(ABCMeta):
@classmethod
def __prepare__(cls, name, bases, **kwargs):
return {}
def __new__(mcls, name, bases, namespa
R. David Murray added the comment:
ABCMeta does not support arbitrary keyword arguments, that is correct. If you
want keyword arguments to be handled, you need to write your own metaclass that
does so.
(I'm pretty sure I'm reading the PEP correctly...if not I'm sure one of the
other core dev
New submission from Timothy Cardenas:
Summary:
Any class that derives from the ABCMeta class doesn't support keyword variable
arguments as defined here :https://www.python.org/dev/peps/pep-3115/.
Expected:
If i define a simple class that derives from ABCMeta that has a kwarg the class
should