[issue30463] Add __slots__ to ABC convenience class

2019-11-15 Thread Chris Withers


Chris Withers  added the comment:

I will note that this means with:

class BaseClass(ABC):
pass


class MyDerivedClass(BaseClass):

def __init__(self, thing):
self.thing = thing

thing = MyDerivedClass()

thing now has both __slots__ and, evidently, a dict. That's a bit weird and 
confusing.

--
nosy: +cjw296

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30463] Add __slots__ to ABC convenience class

2017-06-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +Library (Lib)
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
type:  -> enhancement
versions: +Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30463] Add __slots__ to ABC convenience class

2017-06-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset ff48739ed0a3f366c4d56d3c86a37cbdeec600de by Serhiy Storchaka 
(Aaron Hall, MBA) in branch 'master':
bpo-30463: Add an empty __slots__ to abc.ABC.
https://github.com/python/cpython/commit/ff48739ed0a3f366c4d56d3c86a37cbdeec600de


--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30463] Add __slots__ to ABC convenience class

2017-05-26 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi :


--
nosy: +levkivskyi

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30463] Add __slots__ to ABC convenience class

2017-05-25 Thread Aaron Hall

Changes by Aaron Hall :


--
pull_requests: +1908

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30463] Add __slots__ to ABC convenience class

2017-05-24 Thread Raymond Hettinger

Raymond Hettinger added the comment:

This seems reasonable.

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30463] Add __slots__ to ABC convenience class

2017-05-24 Thread Aaron Hall

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com