Re: Struct usages in Python

2008-05-29 Thread Alex Gusarov
> Yes. That is the somewhat unfortunate difference between new-style and > old-style classes. > Use new-style if you can, and that means that "object" must be part of the > inheritance graph. ... >You are wrong for Python 2.X, but right for Python 3 where old-style > >classes are gone f

Re: Struct usages in Python

2008-05-29 Thread Alex Gusarov
> > Yes. That is the somewhat unfortunate difference between new-style and > old-style classes. Use new-style if you can, and that means that "object" > must be part of the inheritance graph. > ... > You are wrong for Python 2.X, but right for Python 3 where old-style > classes are gone for good.

Re: Struct usages in Python

2008-05-29 Thread Alex Gusarov
> > Yes. That is the somewhat unfortunate difference between new-style and > old-style classes. Use new-style if you can, and that means that "object" > must be part of the inheritance graph. > ... > You are wrong for Python 2.X, but right for Python 3 where old-style > classes are gone for good.

Re: Struct usages in Python

2008-05-28 Thread Alok Kumar
Thanks to everyone for your help. I am able to use array of structure (here Event is a class) in the following manner. But here I am fixing the array index as 4. Is there any easy way to keep it appending dynamically. self.event = [Event() for x in range(4)] # Event is a class as posted in origi

Re: Struct usages in Python

2008-05-28 Thread Arnaud Delobelle
Arnaud Delobelle <[EMAIL PROTECTED]> writes: > "Alex Gusarov" <[EMAIL PROTECTED]> writes: > >>> class Event(object): >>> >>> Always subclass object, unless you have a very compelling reason not to, >>> or you are subclassing something else. >>> >> >> I've thought that if I write >> >> class Event

Re: Struct usages in Python

2008-05-28 Thread Arnaud Delobelle
"Alex Gusarov" <[EMAIL PROTECTED]> writes: >> class Event(object): >> >> Always subclass object, unless you have a very compelling reason not to, >> or you are subclassing something else. >> > > I've thought that if I write > > class Event: > pass > > , it'll be subclass of object too, I was

Re: Struct usages in Python

2008-05-28 Thread Diez B. Roggisch
Alex Gusarov schrieb: class Event(object): Always subclass object, unless you have a very compelling reason not to, or you are subclassing something else. I've thought that if I write class Event: pass , it'll be subclass of object too, I was wrong? Yes. That is the somewhat unfortu

Re: Struct usages in Python

2008-05-28 Thread Alex Gusarov
> class Event(object): > > Always subclass object, unless you have a very compelling reason not to, > or you are subclassing something else. > I've thought that if I write class Event: pass , it'll be subclass of object too, I was wrong? -- Best regards, Alex Gusarov -- http://mail.python.

Re: Struct usages in Python

2008-05-28 Thread J. Cliff Dyer
On Wed, 2008-05-28 at 09:31 -0400, Alok Kumar wrote: > I am getting following error when tried as you suggested. > > self.event = [] #Create an empty list, bind to the name "event" under > the "self" namespace >self.event.append(Event()) #Create an event object and > append to the e

Re: Struct usages in Python

2008-05-28 Thread Alok Kumar
I am getting following error when tried as you suggested. self.event = [] #Create an empty list, bind to the name "event" under the "self" namespace self.event.append(Event()) #Create an event object and append to the end of the list *class Event(): ^ SyntaxError: in

Re: Struct usages in Python

2008-05-28 Thread Alok Kumar
while traversing I get out of index error as mentioned below. class EventTimeFilter: def __init__(self): * self.event = [Event()]* def populateScheduleData(self): self.doc = libxml2.parseFile(self.FILENAME) for eachcamera in self.doc.xpathEval('SetDeviceConfigura

Re: Struct usages in Python

2008-05-27 Thread Casey McGinty
>self.event[] = Event() *# Seems this is not allowed ?? * > self.event = [Event()] - Casey -- http://mail.python.org/mailman/listinfo/python-list

Re: Struct usages in Python

2008-05-27 Thread Patrick Mullen
I don't know if this will go through (my posts seem to have become blocked lately), but I'll give it a shot anyhow. You seem to be under a misconception that a python list is similar to a list in say, Java or other languages that have a rigid idea of variables and types. In python, a list is a li