New submission from Ben Avrahami <avrahami....@gmail.com>:

python-ideas discussion:
https://mail.python.org/archives/list/python-id...@python.org/thread/6BNJ3YSEBPHEPGXSAZGBW3TJ64ZGZIHE/

In order to allow "decorator mixins" (most notably dataclass and 
total_ordering) to implement ABCs, new functionality is needed. I propose a new 
python function in `abc.py` called `update_abstractmethods`. The function will 
accept a class and, if the class is an instance of ABCMeta, will update the 
class's `__abstractmethods__` attribute to not include implemented attributes, 
and to include new abstractmethods (proposed implementation in thread).

Both dataclass and total_ordering will be modified to call this function on the 
subject class before returning it, and 3rd-party libraries which implement 
mixin decorators (like attrs) will be to do the same.

Also, the function can be used as a decorator individually, this is especially 
useful in cases where 3rd party decorators do not call the function.

----------
components: Library (Lib)
messages: 377769
nosy: avrahami.ben
priority: normal
severity: normal
status: open
title: add update_abstractmethods function to update an ABC's abstract methods
type: enhancement
versions: Python 3.10

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

Reply via email to