Re: problems creating and adding class instances to a list:

2010-04-19 Thread Chris Rebert
On Mon, Apr 19, 2010 at 3:41 PM, Xavier Ho wrote: > On Tue, Apr 20, 2010 at 7:38 AM, Chris Rebert wrote: >> Additionally, `self.x = int` might not do what you thought it does. It >> does *not* create a new instance variable of type 'int'. Instead, it >> literally assigns to a new instance variabl

Re: problems creating and adding class instances to a list:

2010-04-19 Thread Xavier Ho
On Tue, Apr 20, 2010 at 7:38 AM, Chris Rebert wrote: > Additionally, `self.x = int` might not do what you thought it does. It > does *not* create a new instance variable of type 'int'. Instead, it > literally assigns to a new instance variable x the *function*† that > converts values into integer

Re: problems creating and adding class instances to a list:

2010-04-19 Thread Chris Rebert
On Mon, Apr 19, 2010 at 2:29 PM, Xavier Ho wrote: > On Tue, Apr 20, 2010 at 7:21 AM, Robert Somerville > wrote: >> >> class ctest(): >>   x = int >>   y = [1,2,3] > > Variables defined directly under the class are known as "static variables" > in many other languages. Here in Python it's called a

Re: problems creating and adding class instances to a list:

2010-04-19 Thread Xavier Ho
On Tue, Apr 20, 2010 at 7:21 AM, Robert Somerville < rsomervi...@sjgeophysics.com> wrote: > class ctest(): > x = int > y = [1,2,3] > Variables defined directly under the class are known as "static variables" in many other languages. Here in Python it's called a class variable, but they're sti