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/030382.html below:

[Python-Dev] from tuples to immutable dicts

[Python-Dev] from tuples to immutable dictsBrett Cannon bac@OCF.Berkeley.EDU
Sat, 23 Nov 2002 16:55:44 -0800 (PST)
[Martin v. Loewis]

> Fred once had a plan to expose structseqs to Python, to allow the
> creation of new structs in Python. I was suggesting that there should
> be a method new.struct_seq, which is called as
>
> struct_seq(name, doc, n_in_sequence, (fields))
>
> where fields is a list of (name,doc) tuples. The resulting thing would
> be similar to os.stat_result: you need to call it with the mandatory
                                    ^^^^^^^
You meant "can", right, Martin?

> fields in sequence, and can call it with the optional fields by
> keyword argument.
>

I think the idea is good if you can get it to tie directly into C code.
That would get a +1 from me.  If not, then +0.  Kind of strikes me like a
poor man's object with __getitem__ written to call the object's attributes
assigned a numeric name.  Or can be viewed as a tuple with attribute names
for each index.

If my Perl memory is not too rusty then I think this would be like Perl's
arrays which might help get more people over from Perl (if we really want
that =).

-Brett




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