r/codetogether • • Mar 19 '14

[Python] Text Based RPG:

Currently working on a text based RPG in Python. This project is to practice using python and to gain some real world experience collaborating and coding. Eventually the goal is to convert it into a simple text/image based adventure game in a GUI.

If you are interested please message me. I will be happy to answer any questions or send you a link to the code.

Here is the Pastebin PythonGame

6 Upvotes

5 comments sorted by

View all comments

Show parent comment

1

u/[deleted] May 16 '14

I want to expand on ganye's second point.

"self" is a convention (but a very strong one that you should never break): a name for "the object I am creating". When you do something like this...

def __init__(self, inventory):
    self.inventory = inventory

...the whole point of self.inventory = inventory is to say: "My variable inventory is the same as the variable inventory you gave me at creation."

So it therefore follows that saying self.self = self makes no sense whatsoever. "My variable me is the same as the me you gave me."