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
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
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://
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
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