[Tutor] data structure question

Kent Johnson kent37 at tds.net
Fri Jan 18 20:35:07 CET 2008

Alexander wrote:

> * A list of tasks, where each task has a number of attributes.
> Each task should be able to have subtasks.

Sounds like you should keep the Task objects in a list :-)
Possibly just the top-level tasks should be in the list...

> * A way to filter/search on the attributes of the tasks.
> What I've tried so far is something like this:
> <snip>
> class Task(object):
> 	def __init__(self, cargo, children=[]):

Don't use mutable objects as default arguments! See
for an explanation.


More information about the Tutor mailing list