is this data structure build-in or I'll have to write my own class?

Jorge Vargas jorge.vargas at gmail.com
Wed Feb 20 09:32:02 EST 2008


On Feb 20, 2008 8:15 AM, Larry Bates <larry.bates at websafe.com> wrote:
> Jorge Vargas wrote:
> > I need a data structure that will let me do:
> >
> > - attribute access (or index)
> > - maintain the order (for iter and print)
> > - be mutable.
> >
> > in case there isn't one. I was thinking having a base class like Bunch
> > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52308 and on
> > top of that keeping a list of the keys and pop/push to the list when
> > adding/deleting items. I don't like this idea because I'll have to
> > keep each key twice. (in the list and in __dict__, is this the only
> > way of doing it?
>
> Sounds like a good time to learn ElementTree (included in Python 2.5 but
> available for earlier versions).
I am using ET, to fetch the data from the XML, after that I want a
plain python object. for the rest of the program.

>
> -Larry
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list