[Tutor] Dictionaries versus classes

Michele Alzetta michele.alzetta at gmail.com
Mon Feb 6 19:19:06 CET 2006


Hi all,

after a longish pause I've taken up my pet python project again (must say
that the decisive factor was the discovery of how easy it is to code the GUI
with QT designer and pyqt).

The core of the problem I'm facing, however, is not the GUI, it is
conceptual.

In the end my program will have to create a printed representation of a
certain number of "things" which are characterized by each having a time
attribute (moment when they start, moment when they end); each "thing" will
have to be filled in by a certain content, chosen from a user defined list
of possibilities; however each thing will also have to have a series of
other attributes ... which will change during the process of assigning
content (for instance: once content 'A' is assigned to foo, bar immediately
following may well change some attribute ...  BUT the effect of content A on
foo and bar may well be different from the effect of content B. Naturally if
content A is present in a certain thing it can't be present in a
contemporaneaous one... sounds a mess ? It is ... also, the rules by which A
and B influence the content will have to be modifiable by the user.)

At the moment I am collecting user input into a dictionary of lists. The
question is: do you believe it would be better to code a series of functions
to interact with my dictionary and keep data, attributes etc. in lists
therein, or would it be more efficient to create an appointment
class, create a new instance of each class for each appointment, and
eventually store each instance in a dictionary ?

Where could I read up something about relative advantages / disadvantages of
each approach ?

Thanks for any hints.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060206/ec7f0c2e/attachment.html 


More information about the Tutor mailing list