structs in python

Paul Rubin phr-n2002b at NOSPAMnightsong.com
Mon Jul 8 02:29:28 EDT 2002


list-python at ccraig.org (Christopher A. Craig) writes:
> Why don't you just use a dict?  
> 
> >>> p = {'x'=10, 'y'=11, 'color'=blue}
> >>> print p['x']
> 10

Typing p['x'] is more cumbersome than typing p.x and doesn't convey
the same type of meaning.  p.x sounds more like it refers to a fixed
slot in a structure.



More information about the Python-list mailing list