self.var hmm?

Martin Marcher martin at marcher.name
Tue May 20 17:11:35 EDT 2008


Hi,

that's because

self.group is not the same as TaskGroup.group

quickish:

class TaskGroup
  group = []
  def __init__(self):
    """
      ## note that all TaskGroup instances now use the the same self.group
    """
    self.group = TaskGroup.group
  def addTask(self, task):
    self.group.append(task)

hth
martin

On Tue, May 20, 2008 at 10:58 PM,  <notnorwegian at yahoo.se> wrote:
> class TaskGroup:
>    def __init__(self):
>        self.group = []
>
>    def addTask(self, task):
>        self.group.append(task)
>
>
> is this wrong? i have a program thats too big to post but should i
> just do group.append in addTask?
>
> reason is when later doing TaskGroup.group i get None
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
http://www.xing.com/profile/Martin_Marcher

You are not free to read this message,
by doing so, you have violated my licence
and are required to urinate publicly. Thank you.



More information about the Python-list mailing list