Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add describe() methods to all of the classes in the sandbox #37

Open
wsowens opened this issue Apr 20, 2019 · 0 comments
Open

Add describe() methods to all of the classes in the sandbox #37

wsowens opened this issue Apr 20, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request high-priority Needs immediate attention

Comments

@wsowens
Copy link
Member

wsowens commented Apr 20, 2019

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:

class Foo:
    _name               # private variable holding the name

    def __repr__(self): # returns a proper, pythonic representation

    def __str__(self):  # returns the name

    def describe(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.

@wsowens wsowens added enhancement New feature or request high-priority Needs immediate attention labels Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request high-priority Needs immediate attention
Projects
None yet
Development

No branches or pull requests

2 participants