Jump to content
GameDev.net Posting Guidelines (please read before posting)
For Beginners Forum FAQs (please read before posting)
Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 14 August 2014 - 06:36 PM
Those %r and %s are placeholders for the actual text you'll see later when the code actually runs. You send an object to the print command for each %r, %s and any other "%" that should be replaced and python has to translate that object to text somehow so those placeholders can be replaced. When you use %r python will call the "repr" method with the object that corresponds to that position as a parameter, and will replace %r with the result or "repr()". When you use %s python will use a different method, "str".
Your classes should implement those methods in a way that makes sense, accodring to the documentation:
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.