Re: [Tutor] calling class instances in functions

2007-09-12 Thread Michael Langford
I too am a little confused what exactly you're going for, but here is a shot at the two things I think you could be asking for: If you're trying to create a world where you have it populated with several different types of cells at different coordinates, and you'd like to make it so the user can s

Re: [Tutor] calling class instances in functions

2007-09-12 Thread Kent Johnson
Ara Kooser wrote: Your question is not very clear but I made some guesses below. > zz = raw_iput("What kind of yeast cell do you want to add? > Options:GoodYeast") > #Here I want to call this instace of GoodYeast from yeast_cell.py So you want the user to input the name of a class

Re: [Tutor] calling class instances in functions

2007-09-12 Thread Alan Gauld
"Ara Kooser" <[EMAIL PROTECTED]> wrote > In the main program at the function def add_yeast(world): I want to > instance the class GoodYeast and have the global variable @ change > to > G on the world. I tried just creating an instance but that did not > go > over so well. "did no go over so we

Re: [Tutor] calling class instances in functions

2007-09-11 Thread John Fouhy
I'm not sure I understnad your quesiton.. You can put classes into lists, dictionaries, et cetera. For example: ## class Foo(object): pass class Bar(object): pass class Baz(object): pass my_classes = { 'foo':Foo, 'bar':Bar, 'baz':Baz } thing = my_classes['bar']() ## It seems qui

[Tutor] calling class instances in functions

2007-09-11 Thread Ara Kooser
Thank you for your help on classes. I am working on an old program I started in 2005. This time around I am trying to model cell behavior using a PD model. I have the main program and then a file called yeast_cell.py that contains the classes I want to instance. In the main program at the function