A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2002-November/030561.html below:

[Python-Dev] from tuples to immutable dicts

[Python-Dev] from tuples to immutable dictsArmin Rigo arigo@tunes.org
Fri, 29 Nov 2002 03:50:43 -0800 (PST)
Hello Martin,

On Sun, Nov 24, 2002 at 06:10:54PM +0100, Martin v. Loewis wrote:
> >    point = tuple(5, 6, color=RED, visible=False)
> 
> I have to problems imagining such an extension:
> 
> 1. I'm not sure this would be useful.
> 2. I can't imagine how to implement it, without compromising performance
>    for tuples.

By introducing a subtype of tuple, just as you do in Python.  By the
way, doing it in Python is a nice thing, but then we end up with two
ways of making this kind of small structures: one easily available in
Python but not in C, and one (structseq) for C.  Having a C-based
implementation of tuple-with-immutable-dict would unify the two.  But
well, I realize that I'm getting stuck with minor things here.

An example that comes in mind where a C-based immutable dict would be
handy is to implement table-based jumps in the bytecode (for switches),
but again this discussion drifted in incompatible directions as we need
non-string keys for this.

Let's just forget it all.


Armin




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4