[Python-3000] Composable abstract base class?

Ka-Ping Yee python at zesty.ca
Sun May 27 10:18:49 CEST 2007


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


More information about the Python-3000 mailing list