This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author uriyyo
Recipients uriyyo
Date 2021-02-17.17:28:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1613582892.97.0.748094590346.issue43243@roundup.psfhosted.org>
In-reply-to
Content
Basically, the idea is to add the ability to mark abstract classes as strict.

What does this mean - in case when a class inherits from a strict abstract base class and doesn't implement all abstract methods then it will fail to create a class.

For instance:
>>> class Iterable(ABC, strict=True):
...   @abstractmethod
...   def __iter__(self):
...      pass

>>> class MyClass(Iterable):
...   pass
TypeError: Can't create class MyClass with unimplemented strict abstract method __iter__

That allows creating abc classes and be sure that class defines a required method, it will be perfrormed on a class declaration stage rather than class instance creation.
History
Date User Action Args
2021-02-17 17:28:13uriyyosetrecipients: + uriyyo
2021-02-17 17:28:12uriyyosetmessageid: <1613582892.97.0.748094590346.issue43243@roundup.psfhosted.org>
2021-02-17 17:28:12uriyyolinkissue43243 messages
2021-02-17 17:28:12uriyyocreate