Intro to Python


Rhino can run Python scripts with 2 different interpreters:

CPython: is the standard Python interpreter. It is the one that you can download from the [Python website](https://www.python.org/downloads/). It is available from *Rhino8* and it can interpret Python3.x scripts. This is what we will use in this course.


IronPython: is a flavour of Python that integrates the .NET ecosystem (on which Grasshopper was built) and Python libraries. It is available from *Rhino5* and it can interpret `Python2.x`. It will probably be deprecated, and we will not use it in this course.


⚠️⚠️⚠️ Why it is important to know the difference?: Let’s say the they are very similar but they are not the same. When you will be searching the web or chatgpting for solutions, be sure to mention CPython or Python3 in your search. Otherwise you might find solutions that will not work. ⚠️⚠️⚠️


How to choose an interpreter?


Be sure to choose the CPython interpreter when you are running a script. You can choose the interpreter in the ScriptEditor new file button and choose the correct logo.

OR, you can specify the shebang at the beginning of your script. The shebang is a special comment that tells the computer which interpreter to use. It is usually the first line of a script.

#! python3

<your-code-goes-here>
...