class problem, NoneType obj has no attribute

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Fri May 16 09:45:38 EDT 2008


globalrev a écrit :
> On 16 Maj, 14:19, Bruno Desthuilliers <bruno.
> 42.desthuilli... at websiteburo.invalid> wrote:
>> globalrev a écrit :
(snip)
>>> cust1 = customer.__init__('12',['1','435','2332'])
>> __init__ is automagically called on instanciation, so you don't have to
>> call it yourself. And FWIW, your __init__ returns None.
> 
> what should init return normally?

None. Your __init__ is fine, the problem is with the call. To 
instanciate a class, you call the class object itself, passing it the 
arguments awaited by __init__, ie:


cust1 = Customer('12', ['1', '435', '2332'])



More information about the Python-list mailing list