Where to find help...
The RhinoPython community is very active and offers a wonderful resource for posting questions/answers and finding help on just about anything!: http://python.rhino3d.com/forums/
General References for Python:
Python’s main website offers a plethora of information about the syntax, building-in functionality, libraries etc! This is the main resource for anything Python! http://docs.python.org/
A very useful Python style guide: http://www.python.org/dev/peps/pep-0008/
Another very thorough resource for Python is from MIT, called “How to Think Like a Computer Scientist”: http://www.greenteapress.com/thinkpython/thinkCSpy/thinkCSpy.pdf
For a list of common errors, exceptions and pitfalls that you are likely to run into when coding see: http://docs.python.org/release/3.1.3/library/exceptions.html#bltin-exceptions http://secant.cs.purdue.edu/_media/proghints.pdf
Syntax & Programming Reminders:
- Python is Case Sensitive (“A” and “a” are NOT the same thing!)
- Python is Indent Sensitive (Use indentation to delineate the scope of loops, conditionals, functions and classes) Remember an extra space or the absence of a space can make a world of a difference!
- You do NOT need to declare variables or variables types! Just simply use them (x=3)!
- The “ # “ sign is used for comments, the computer will skip over them.
- Print and Return are NOT the same thing - print writes something to the screen, return actually passes a value!
- Remember Variable Scope - where you define a variable is important! Variables defined within functions & classes can only be used within those functions/classes unless passed as input or through the return statement!
- “return” only works inside a function.
- Develop code incrementally, testing, debugging and printing as you finish smaller sections. Writing hundreds of lines and hitting run will most likely not work and will make it far more difficult to spot errors!
***If this makes no sense to you yet - no fear! Keep reading (and come back to it later)!…