What is the correct syntax for calling an instance method on a class named Game?

Advertisement

  • >>> dice = Game()
    >>> dice.roll()
  • >>> dice = Game(self)
    >>> dice.roll(self)
  • >>> dice = Game()
    >>> dice.roll(self)
  • >>> dice = Game(self)
    >>> dice.roll()

or

  • my_game = Game()
    my_game.roll_dice()
  • my_game = Game()
    self.my_game.roll_dice()
  • my_game = Game(self)
    self.my_game.roll_dice()
  • my_game = Game(self)
    my_game.roll_dice(self)
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Leave a Comment

Share via
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.