Lie Ryan wrote:
On Sat, 25 Oct 2008 18:20:46 -0400, Terry Reedy wrote:
a = list([1, 2, 3, 4, 5], implementation = 'linkedlist')
For this to work, the abstract list would have to know about all
implementations of the abstraction.
/the exact syntax isn't really important/
/abstract type and implementation separation is the important point/
Actually, if I want to force it, that syntax could work using the same
magic used by event-based systems: registration.
ABCs have registration method. The builtin ABCs have appropriate
builtin classes preregistered.
>>> import collections as co
>>> mu = co.MutableSequence
>>> issubclass(list, mu)
True
I believe user classes that inherit from an ABC are also registered, and
other can be registered explicitly.
Although I agree it
might be a bit cumbersome to do registration for something like this, but
as I've said before, exact syntax is not really important.
Then why do you object to current
mylist = linkedlist(data)
and request the harder to write and implement
mylist = list(data, implementation = 'linkedlist')
?
tjr
--
http://mail.python.org/mailman/listinfo/python-list