What is the purpose of the word ‘self’?

The reason you need to use self. is because Python does not use the @ syntax to refer to instance attributes. Python decided to do methods in a way that makes the instance to which the method belongs be passed automatically, but not received automatically: the first parameter of methods is the instance the method is called on. That makes methods entirely the … Read more

‘pip’ is not recognized as an internal or external command

You need to add the path of your pip installation to your PATH system variable. By default, pip is installed to C:\Python34\Scripts\pip (pip now comes bundled with new versions of python), so the path “C:\Python34\Scripts” needs to be added to your PATH variable. To check if it is already in your PATH variable, type echo %PATH% at the CMD … Read more

Is there a way to create multiline comments in Python?

You can use triple-quoted strings. When they’re not a docstring (the first thing in a class/function/module), they are ignored. (Make sure to indent the leading ”’ appropriately to avoid an IndentationError.) Guido van Rossum (creator of Python) tweeted this as a “pro tip”. However, Python’s style guide, PEP8, favors using consecutive single-line comments, like this: …and this is also what you’ll find … Read more