class problem, NoneType obj has no attribute
Peter Otten
__peter__ at web.de
Fri May 16 09:19:41 EDT 2008
globalrev wrote:
> On 16 Maj, 13:54, Peter Otten <__pete... at web.de> wrote:
>> Christian Heimes wrote:
>> > globalrev schrieb:
>> >> cust1 = customer.__init__('12',['1','435','2332'])
>>
>> > cust1 = customer('12',['1','435','2332'])
>>
>> ... and before that
>>
>> from customer import customer
>>
>> Peter
>
> why do i have to write that?
>
> if i do import customer im importing everything no?
>
> but youre right it doesnt work unless i do, i just dont get why.
It becomes clearer if you follow the usual naming conventions and start the
class name with an uppercase letter:
# in file customer.py
class Customer:
# your code
The import then becomes
from customer import Customer
i. e. the first "customer" denotes the module, the second "Customer" the
class.
Peter
More information about the Python-list
mailing list