Creating a list with holes
Roy Smith
roy at panix.com
Fri Jan 3 20:18:06 EST 2014
In article <mailman.4871.1388794533.18130.python-list at python.org>,
Larry Martell <larry.martell at gmail.com> wrote:
>
> Thanks, but I know all that about dicts. I need to use a list for
> compatibility with existing code.
Generalizing what I think the situation is, "A dict is the best data
structure for the parsing phase, but I need a list later to hand off to
legacy interfaces".
No problem. Parse the data using a dict, then convert the dict to a
list later. I haven't been following all the details here, but just
wanted to point out that using different data structures to hold the
same data at different phases of a program is a perfectly reasonable
approach.
More information about the Python-list
mailing list