[Tutor] dicts&lists vs objects
Brian van den Broek
bvande at po-box.mcgill.ca
Thu May 12 05:38:03 CEST 2005
Chris Somerlot said unto the world upon 2005-05-11 15:02:
> I have been working on a scientific application for awhile, and
> have been using dictionaries and lists to store data and attributes
> of datasets. This is getting cumbersome as there are many, every
> dict/list is a premutation of another, and I'm having trouble
> following the code I've written.
>
> Is there a golden rule to knowing when to use objects instead of
> dictionaries and lists?
>
Hi Chris,
first, while I believe I understand what you mean in the last line,
there is a mistaken assumption behind it -- lists and dictionaries
*are* objects :-)
I take you to mean "when should I use builtin objects like lists and
dictionaries, and when should I use classes to define my own object
types instead?"
I'm still fairly early on in getting the hang of OOP design. But, I've
found that experiencing confusion over the structure of my own none-OO
code is a pretty reliable sign that converting the approach to OOP
might be worth a serious thought :-)
If you could say a bit more about your problem space, perhaps I, or
someone more experienced, will be able to say something more specific
to help.
Best,
Brian vdB
More information about the Tutor
mailing list