RE: Newbie question on Classes

2008-01-11 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of John Machin > Sent: Friday, January 11, 2008 4:08 PM > To: python-list@python.org > Subject: Re: Newbie question on Classes > > On Jan 11, 9:27 am, "Reedick, Andr

Re: Newbie question on Classes

2008-01-11 Thread John Machin
On Jan 11, 9:27 am, "Reedick, Andrew" <[EMAIL PROTECTED]> wrote: > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:python- > > [EMAIL PROTECTED] On Behalf Of Adrian Wood > > Sent: Thursday, January 10, 2008 4:47 PM > > To: [EMAIL PROTECTED] > > Subject: Newbie question on Classes >

Re: Newbie question on Classes

2008-01-11 Thread Nanjundi
On Jan 10, 5:32 pm, "Steven Clark" <[EMAIL PROTECTED]> wrote: > > l = [] > > l.append(man) > > l.append(woman) > > > # Print the state. > > for item in l: > > print item.state() > > Small, off-topic nitpick: > please don't use "l" (lower-case el) as a variable name. > > >Fromhttp://www.python.or

Re: Newbie question on Classes

2008-01-10 Thread John Machin
On Jan 11, 8:46 am, "Adrian Wood" <[EMAIL PROTECTED]> wrote: > Hi al! I'm new to the list, and reasonably new to Python, so be gentle. > > Long story short, I'm having a hard time finding a way to call a > function on every object of a class at once. A class is a factory that creates objects. It k

Re: Newbie question on Classes

2008-01-10 Thread Steven Clark
> l = [] > l.append(man) > l.append(woman) > > # Print the state. > for item in l: > print item.state() > > Small, off-topic nitpick: please don't use "l" (lower-case el) as a variable name. >From http://www.python.org/dev/peps/pep-0008/: "Naming Conventions Names to Avoid Never use the cha

RE: Newbie question on Classes

2008-01-10 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Adrian Wood > Sent: Thursday, January 10, 2008 4:47 PM > To: python-list@python.org > Subject: Newbie question on Classes > > > I can call man.state() and then woman.state() or Person.state(man

Re: Newbie question on Classes

2008-01-10 Thread Erik Max Francis
Adrian Wood wrote: > I can call man.state() and then woman.state() or Person.state(man) and > Person.state(woman) to print the status of each. This takes time and > space however, and becomes unmanageable if we start talking about a > large number of objects, and unworkable if there is an unknown

Re: Newbie question on Classes

2008-01-10 Thread Nanjundi
On Jan 10, 4:46 pm, "Adrian Wood" <[EMAIL PROTECTED]> wrote: > Hi al! I'm new to the list, and reasonably new to Python, so be gentle. > > Long story short, I'm having a hard time finding a way to call a > function on every object of a class at once. Example: > > I have a class Person, which has a

Re: Newbie question on Classes

2008-01-10 Thread Steven Clark
On Jan 10, 2008 4:54 PM, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Adrian Wood wrote: > > > I can call man.state() and then woman.state() or Person.state(man) and > > Person.state(woman) to print the status of each. This takes time and > > space however, and becomes unmanageable if we start talki

Re: Newbie question on Classes

2008-01-10 Thread Fredrik Lundh
Adrian Wood wrote: > I can call man.state() and then woman.state() or Person.state(man) and > Person.state(woman) to print the status of each. This takes time and > space however, and becomes unmanageable if we start talking about a > large number of objects, and unworkable if there is an unknown