Structures

Arnaud Delobelle arnodel at googlemail.com
Mon Nov 3 17:10:20 EST 2008


Ben Finney <bignose+hates-spam at benfinney.id.au> writes:

> "Paulo J. Matos" <pocmatos at gmail.com> writes:
[...]
> Okay, you're talking about ‘struct’ from the C language. That helps
> answer the question.

Note that structs are mutable.

> In Python, the way to do that is with a dict. A class can be used, but
> is often overkill if one doesn't need customised behaviour.
>
>> The fact that python 2.6 has now named tuples is a breath of fresh
>> air!

But isn't mutable, so it doesn't seem to be what you (Paulo) need.

> That works also, but a dict will be more broadly useful; and
> compatible with any Python version.

And is mutable.

-- 
Arnaud



More information about the Python-list mailing list