Thoughts on object representation in a dictionary
py
codecraig at gmail.com
Fri Dec 9 14:37:30 EST 2005
Say I have classes which represent parts of a car such as Engine, Body,
etc. Now I want to represent a Car in a nested dictionary like...
{string_id:{engine_id:engine_object, body_id:body_object}}....ok?
Well the other thing is that I am allowed to store strings in this
dictionary...so I can't just store the Engine and Body object and later
use them. ....this is just a requirement (which i dont understand
either)...but its what I have to do.
So my question is there a good way of storing this information in a
nested dictionary such that if I receive this dictionary I could easily
pull it apart and create Engine and Body objects with the information?
Any suggestions at all? keep in mind I am limited to using a
dictionary of strings...thats it.
Thanks for any input.
More information about the Python-list
mailing list