You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our sandbox is composed of entities, items, characters, and locations.
Each of these classes needs a flexible, describe() method.
For reference, we have agreed upon the following convention:
classFoo:
_name# private variable holding the namedef__repr__(self): # returns a proper, pythonic representationdef__str__(self): # returns the namedefdescribe(self, *args): # returns the a thorough description of the thing
info() should allow for some structured input and return appropriate output.
For example, given Wizard bill:
>>>bill.info("wielding")
"wielding an enchanted staff">>>bill.info("epithet")
"the Wizard">>>bill.info("epithet", "wielding")
("the Wizard", "wielding an enchanted staff")
This isn't set in stone, so other ideas are definitely welcome.
We can probably implement this by having some kind of dictionary.
The text was updated successfully, but these errors were encountered:
Our sandbox is composed of entities, items, characters, and locations.
Each of these classes needs a flexible,
describe()
method.For reference, we have agreed upon the following convention:
info()
should allow for some structured input and return appropriate output.For example, given
Wizard bill
:This isn't set in stone, so other ideas are definitely welcome.
We can probably implement this by having some kind of dictionary.
The text was updated successfully, but these errors were encountered: