[Tutor] __init__() - is it required?

2011-01-09 Thread Corey Richardson
Do all classes need an __init__() method? I have classes that look much like this one starts out: class GenerateXML(object): """Defines methods to be inherited for StaticXML and AnimationXML""" def __init__(self): pass I would rather not do that. Code without it runs fine, but wil

Re: [Tutor] __init__() - is it required?

2011-01-09 Thread Steven D'Aprano
Corey Richardson wrote: Do all classes need an __init__() method? I have classes that look much like this one starts out: class GenerateXML(object): """Defines methods to be inherited for StaticXML and AnimationXML""" def __init__(self): pass I would rather not do that. Code wit

Re: [Tutor] __init__() - is it required?

2011-01-09 Thread Alan Gauld
"Corey Richardson" wrote Do all classes need an __init__() method? I have classes that look much like this one starts out: No, init() is only for initialising the object instance. If you have no local instance spwecific initialisation you can leave it to the inherited init() aor have no ini

Re: [Tutor] __init__() - is it required?

2011-01-09 Thread bob gailer
On 1/9/2011 4:42 PM, Alan Gauld wrote: "Corey Richardson" wrote Do all classes need an __init__() method? I have classes that look much like this one starts out: No, init() is only for initialising the object instance. If you have no local instance spwecific initialisation you can leave it

Re: [Tutor] __init__() - is it required?

2011-01-10 Thread Alan Gauld
"bob gailer" wrote No, init() is only for initialising the object instance. If you have no local instance spwecific initialisation you can leave it to the inherited init() aor have no init() at all. Well I'd like to expand that a bit. There are cases where I create a class attribute and upd

Re: [Tutor] __init__() - is it required?

2011-01-10 Thread Corey Richardson
On 01/09/2011 04:27 PM, Steven D'Aprano wrote: > Corey Richardson wrote: >> Do all classes need an __init__() method? I have classes that look much >> like this one starts out: >> >> class GenerateXML(object): >> """Defines methods to be inherited for StaticXML and AnimationXML""" >> def __