[Python-3000] Composable abstract base class? (original) (raw)
Ka-Ping Yee python at zesty.ca
Sun May 27 10🔞49 CEST 2007
- Previous message: [Python-3000] Composable abstract base class?
- Next message: [Python-3000] Composable abstract base class?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, 27 May 2007, Ryan Freckleton wrote:
I've been following the python-dev and python 3000 lists for over a year, but this is my first posting.
Hello!
I think I've found additional abstract base class to add to PEP 3119. An ABC for composable data (e.g. list, tuple, set, and perhaps dict) to inherit from. An composable object can contain instances of other composable objects. In other words, a composable object can be used as the outer container in a nested data structure. [...] def recurse(sequence): if isinstance(sequence, Composoble): for child in sequence: recurse(child) else: print sequence
I think I understand your example, but I don't understand what makes it necessary to introduce an ABC for Composable as separate from Iterable. What is intended to be different about Composable? Can you provide a usage example for Composable where Iterable would not be sufficient?
-- ?!ng
- Previous message: [Python-3000] Composable abstract base class?
- Next message: [Python-3000] Composable abstract base class?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]