Suggestion: make sequence and map interfaces more similar
Mark Lawrence
breamoreboy at yahoo.co.uk
Sun Mar 27 15:24:18 EDT 2016
On 27/03/2016 19:01, Marco S. via Python-list wrote:
>
> Mark Lawrence wrote:
>
>> I cannot see this happening unless you provide a patch on the bug
>> tracker. However I suspect you can get the same thing by subclassing
>> dict. Why don't you try it and let us know how you get on?
>
> The problem with a vdict is that I should also create by zero a new
> interface (ABC), since MutableMapping have an incompatible contract.
> And to be much more useful I should code it inc C, and my C skills are
> not so magnificent. Furthermore I would try to create a new sequence
> interface that inherit from the vdict interface. More briefly, I need
> much free time. But I suppose I can start with something quick and
> dirty.
>
Why do you need a new interace if all you're trying to do is create a
vdict class that has "iter(d) == iter(d.values()), and should also
have a count() method, like sequence types"?
I don't understand why you think you need C skills. E.g.
SortedContainers https://pypi.python.org/pypi/sortedcontainers "is an
Apache2 licensed containers library, written in pure-Python, and fast as
C-extensions."
I think your quick and dirty might well turn into something useful for
your application.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
More information about the Python-list
mailing list