basic Class in Python

BarryJOgorman barryjogorman at
Mon Jan 18 00:05:35 CET 2010

Working through Lutz's 'Learning Python'

Trying to run the following code (from file - see below):

The file is held in Python31.

at the Python31 prompt am entering '''

Getting the following error:
Traceback (most recent call last)
File "C:python31\", line 9, in (module)
bob=Person('Bob Smith', job='barman', pay =34000)
TypeError: object._new_() takes no parameters

#Add incremental self test code

class Person:
    def _init_(self, name, job=None, pay=0): = name
        self.job = job = pay

bob = Person('Bob Smith', job='barman', pay = 34000)
sue = Person('Sue Jones', job='dev', pay=100000)

More information about the Python-list mailing list