Python Forum
Confusion about TypeError and 'self'
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Confusion about TypeError and 'self'
#2
Showing all your code would be helpful.

My guess is you have written a class and play is one of the methods of the class. To call a method the correct syntax is object.method(arguments). Python uses the object to find out where to look for method. It then calls the method like this "method(object, arguments).

Somewhere you are creating an instance of you class and hopfully keeping the returned object in a variable. Something like this:

myobject = MyClass(maybe, some, args)

To call the play method you would type:

myobject.play()
Reply


Messages In This Thread
Confusion about TypeError and 'self' - by Muzzrooms - Apr-29-2020, 09:48 PM
RE: Confusion about TypeError and 'self' - by deanhystad - Apr-29-2020, 10:04 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020