"Marilyn Davis" <[EMAIL PROTECTED]> wrote

When see nested builtin data structures, I always think it's time to think
of making a few classes instead.

It could be, especially if you are about to write a bunch of
functions to access those structures. But equally if the
structures accurately reflect the problem and acess does
not require any complex processing then I'm happy to use
the structures.

In a case like this I'd still tend to move to a database rather
than an OOP solution, although I might use classes to hold
the returned data.

I'm still not clear why the OP wants to hold the data in
memory.

Alan G

Python tutors, is this a good suggestion?

Marilyn Davis



[{'id': <group id>,
'category': [{'id': <category id>,
'sub-category': [ {'id': <sub-category id>,
'title': <sub-category title>,
'is_selected': <True | False>
}
...]
'title': <category title>,
'is_selected': <True | False>
}
...]
'title': <group title>,
'is_selected': <True | False>,
}
...]


Reason for this is that I want to create a navigational menu for a web template so that when you click on group_id the value is sent and this pulls the 'categories' and when you click on the category then the sub-
categories are listed.

Thanks
David




__________________________________________________________


Find out what Tiscali can do for you - http://www.tiscali.co.uk/services


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor




_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor



_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to