Re: Structure accessible by attribute name or index

2010-03-17 Thread Wes Santee
On Mar 17, 11:34 am, Bruno Desthuilliers wrote: > Wes Santee a écrit : > > > I am very new to Python, and trying to figure out how to create an > > object that has values that are accessible either by attribute name, > > or by index.  For example, the way os.stat() returns a stat_result or > > pwd

Re: Structure accessible by attribute name or index

2010-03-17 Thread Wes Santee
On Mar 17, 11:14 am, Christian Heimes wrote: > Wes Santee wrote: > > I am very new to Python, and trying to figure out how to create an > > object that has values that are accessible either by attribute name, > > or by index.  For example, the way os.stat() returns a stat_result or > > pwd.getpwna

Re: Structure accessible by attribute name or index

2010-03-17 Thread Bruno Desthuilliers
Christian Heimes a écrit : However Python 2.6 has a new factory that creates a similar datatype called named tuple: http://docs.python.org/library/collections.html#namedtuple-factory-function-for-tuples-with-named-fields Duh... Should spend some more time reading 2.6's What's New :( -- http://

Re: Structure accessible by attribute name or index

2010-03-17 Thread Bruno Desthuilliers
Wes Santee a écrit : I am very new to Python, and trying to figure out how to create an object that has values that are accessible either by attribute name, or by index. For example, the way os.stat() returns a stat_result or pwd.getpwnam() returns a struct_passwd. In trying to figure it out, I

Re: Structure accessible by attribute name or index

2010-03-17 Thread Christian Heimes
Wes Santee wrote: > I am very new to Python, and trying to figure out how to create an > object that has values that are accessible either by attribute name, > or by index. For example, the way os.stat() returns a stat_result or > pwd.getpwnam() returns a struct_passwd. > > In trying to figure it