[Python-ideas] Identity dicts and sets

Haoyi Li haoyi.sg at gmail.com
Wed Jan 2 21:45:17 CET 2013


Something curried?

custom_dict(cfg=...)(key1=..., key2=...)


On Thu, Jan 3, 2013 at 4:37 AM, Mike Meyer <mwm at mired.org> wrote:

> On Wed, Jan 2, 2013 at 2:34 PM, Serhiy Storchaka <storchaka at gmail.com>
> wrote:
> > середа 02 січень 2013 21:43:47 Eli Bendersky ви написали:
> >> I agree that the data structures may be useful, but is there no way to
> some
> >> allow the customization of existing data structures instead, without
> losing
> >> performance? It's a shame to have another kind of dict just for this
> >> purpose.
> >> What interface for the customization is possible? Obviously, a dict
> > constructor can't have a special keyword argument.
>
> How about a set_key method? It takes a single callable as an argument.
> You'd get your behavior with dict.set_key(id). If called when the dict
> is non-empty, it should throw an exception.
>
>    <mike
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130103/35cec654/attachment.html>


More information about the Python-ideas mailing list