Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • That definitely makes sense as well and I could check before calling the method if the previous value is different than the value returned from the API. My follow up to this is that if period_remaining isn't an attribute of Team how do I reference it in that class? Commented Jan 22, 2018 at 23:49
  • Give the Team instance a reference to your Game instance. If Game is created before teams are, add a game parameter to Team.__init__. If teams are created first, add self.game = None to the body of Team.__init__ and then set it manually after game is created. Commented Jan 22, 2018 at 23:53
  • You could even get fancy and have a Game.register_team(team) method that would set the appropriate attributes of both objects from a central place, if they need to know about each other. Commented Jan 22, 2018 at 23:54
  • Without knowing what all your Game instance needs to do, it's hard to recommend one alternative over another. Commented Jan 22, 2018 at 23:54
  • Game is created before each Team so adding a reference to the Game inside each Team makes a lot of sense - maybe I'll give that a shot and report back. If I wanted to go with the Game.register_team(team) option and each Game has two Teams how would I go about that? Commented Jan 23, 2018 at 0:00