0
# Class and Instance Variables
class Dog:
    kind = 'canine'

    def __int__(self, name):
        self.name = name
        self.tricks = []

d = Dog('Fido')
e = Dog('Buddy')

print(d.kind)
print(e.kind)
print(d.name)
print(e.name)

Error report:

Traceback (most recent call last):
  File "dog.py", line 13, in <module>
    d = Dog('Fido')
TypeError: object() takes no parameters
martineau
  • 119,623
  • 25
  • 170
  • 301
chentaocuc
  • 177
  • 1
  • 2
  • 8
  • 3
    Typo: `__int__` should be `__init__`. – tom Jun 18 '17 at 03:04
  • Thank you very much! I have correct the mistake you have pointed out. – chentaocuc Jun 18 '17 at 03:06
  • You are welcome :) I've re-posted my comment as an answer. If your problem is solved, feel free to [mark the answer as accepted](https://meta.stackexchange.com/a/5235). Otherwise, add details to your question or ask a new question. – tom Jun 18 '17 at 03:16

1 Answers1

4

You have a typo. The method __int__ should be called __init__.

tom
  • 21,844
  • 6
  • 43
  • 36