- The Python interpreter parses Python files and generates compiled bytecode (.pyc) files.
- Python was designed as a general purpose language. It makes no assumptions about being in a Web environment.
- Variables do not need to be declared before assigning a value to them.
- Variables do not use a sigil to indicate type.
- Indentation represents a code block.
- Objects are bound to methods or variables via the . operator.
Basic Python script
#!/usr/bin/python
class cat:
def __init__(self, hair, name, weight):
self.hair = hair
self.name = name
self.weight = weight
def purr(self, volume):
return volume * self.weight
if __name__ == '__main__':
spook = cat('black', 'Spook', 3.2)
print spook.purr(3)