Re: [Tutor] data structure question

2008-01-28 Thread Alexander
Thanks for all the responses. I'm using this both as an opportunity to learn and to create something that does exactly what I want it to so that's why I want to write my own program. I decided to go with a flat list in the end. Now I have a working implementation but it's not as nice as I think it

Re: [Tutor] data structure question

2008-01-18 Thread Alan Gauld
"Tiger12506" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >>def recursive_print(self, level=0): >>print "\t"*level + self.cargo >>for x in self.children: >> recursive_print(x,level+1) > > Whoops. should be > > for x in self.children: >x.recursive_pr

Re: [Tutor] data structure question

2008-01-18 Thread Alan Gauld
"Tiger12506" <[EMAIL PROTECTED]> wrote > class Task(object): > ... >def recursive_print(self, level=0): >print "\t"*level + self.cargo >for x in self.children: > recursive_print(x,level+1) x.recursive_print(level+1) Is what you meant I think :-) Alan

Re: [Tutor] data structure question

2008-01-18 Thread Terry Carroll
On Fri, 18 Jan 2008, Alexander wrote: > I'm trying to write a small todo list/task manager... Hi, Alexander. Not to derail your actual question, but have you looked at Task Coach? It's a small todo list/task manager, written in Python using wxPython. It does much, perhaps all, of what you're

Re: [Tutor] data structure question

2008-01-18 Thread Tiger12506
>def recursive_print(self, level=0): >print "\t"*level + self.cargo >for x in self.children: > recursive_print(x,level+1) Whoops. should be for x in self.children: x.recursive_print(level+1) ___ Tutor maillist - Tutor@

Re: [Tutor] data structure question

2008-01-18 Thread Tiger12506
> > class Task(object): > def __init__(self, cargo, children=[]): > self.cargo = cargo > self.children = children > > def __str__(self): > s = '\t'.join(self.cargo) > return s > > def add_child(self,child): > self.children = self.children + [child] This is an excellent start. self.children = self

Re: [Tutor] data structure question

2008-01-18 Thread Kent Johnson
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

[Tutor] data structure question

2008-01-18 Thread Alexander
Hi all, I'm trying to write a small todo list/task manager and I'm having trouble creating the right data structure to hold the tasks. The program should have a command line interface. This is what I want it to do: * A list of tasks, where each task has a number of attributes. Each task should b

Re: [Tutor] Data structure question / PyGoogle

2006-09-16 Thread Python
(forwarding to list) On Sat, 2006-09-16 at 10:31 -0500, Brian Edward wrote: > Thanks for the quick reply! I really appreciate your assistance. Of > course, it will take some time to get this worked out, but your > explanation is very clear. > > Best, > Brian > > > On 9/16/06, Python <[EMAI

Re: [Tutor] Data structure question / PyGoogle

2006-09-16 Thread Python
On Sat, 2006-09-16 at 09:44 -0500, Brian Edward wrote: > Hello all, > > I am new to Python (and programming in general) and am trying to get > PyGoogle figured out for some specific research interests. Basically, > I have done a simple search using PyGoogle and have some sitting in > memory. I h

Re: [Tutor] Data structure question / PyGoogle

2006-09-16 Thread Alan Gauld
> In this list, I have ten URL saved, which I can access by using the > brackets > and noting the specific elements. For example: > data.results[0].URL > 'http://www.psychguides.com/gl-treatment_of_schizophrenia_1999.html' > My question is, how can I access all ten URLs in a single command.

[Tutor] Data structure question / PyGoogle

2006-09-16 Thread Brian Edward
Hello all,I am new to Python (and programming in general) and am trying to get PyGoogle figured out for some specific research interests.  Basically, I have done a simple search using PyGoogle and have some sitting in memory.  I have an object data.results, which is apparently a list:>>> type(data