New submission from Yurii Karabas <1998uri...@gmail.com>:

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.

----------
components: Library (Lib)
messages: 387169
nosy: uriyyo
priority: normal
severity: normal
status: open
title: Strict ABC classes
type: enhancement
versions: Python 3.10

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43243>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to