Cool object trick

has has.temp2 at
Fri Dec 17 16:14:41 CET 2004

Jive wrote:

> # Is that really much different from this?

Functionally, no. However it can help make code more readable when
dealing with complex data structures, e.g. compare:




I've used it a couple times for this particular reason and it
definitely has its niche; though I'm not sure it's sufficiently common
or useful to justify its inclusion it in the standard library, and it's
trivial to whip up as-and-when it's needed.

BTW & FWIW, I think the usual name for this kind of structure is
'record' (or 'struct' in C).



More information about the Python-list mailing list