New submission from Aaron Hall:

We have __slots__ with other ABC's, see http://bugs.python.org/issue11333 and 
http://bugs.python.org/issue21421.

There are no downsides to having empty slots on a non-instantiable class, but 
it does give the option of denying __dict__ creation for subclassers. 

The possibility of breaking is for someone using __slots__ but relying on 
__dict__ creation in a subclass - they will have to explicitly add "__dict__" 
to __slots__. Since we have added __slots__ to other ABC's, 

I will provide a PR soon on this. Diff should look like this (in Lib/abc.py):

class ABC(metaclass=ABCMeta):
    """Helper class that provides a standard way to create an ABC using
    inheritance.
    """
- pass
+ __slots__ = ()

(I also want to add a test for this, and ensure other ABC's also have this if 
they don't.)

----------
messages: 294389
nosy: Aaron Hall
priority: normal
severity: normal
status: open
title: Add __slots__ to ABC convenience class

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

Reply via email to