Re: how to let a python class accept more than 1 instent going?

hey make sure that any method you have on a class has self as the first parameter (the name technically doesn't matter, but the convention is self). This value (self) is used to refer to the class (self.somevar, etc). for example

class SomeClass:

    def __init__(self, name, x, y):
        #assign stuff

instance = SomeClass("name", 0, 1) #Notice how you only call the method with 3 parameters, not 4 but when you declare the method you use 4

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : mohamed via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Lucas1853 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : mohamed via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : visualstudio via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : stewie via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : stewie via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : visualstudio via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Turret via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : bhanuponguru via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : mohamed via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Turret via Audiogames-reflector

Reply via email to