C# or Python for Grasshopper

Hi,

With the release of the new version, I decide to allocate time to learn Grasshopper programming aspects better. One question which is often asked is what to learn C# or python? Therefore, any updated comments, preferences or ideas?

Thanks

If you’re new to programming, go with Python. It’s far easier to learn and the internet is stock full of learning resources. You can still switch to C# (or a superior language) later, if you deem that necessary.
I started with Python years ago. It’s still my favorite language. It’s not the fastest in terms of performance, but for most things it’s more than enough. It’s a premium prototyping language, since it’s very fast to type.

1 Like

The big new update to add for Rhino 8 is that it comes with CPython 3, in addition to IronPython. So it really depends on what your programming goals are (e.g. do you want to implement all the scientific computing packages available in Python, or do you want to write a compiled Grasshopper plugin that implements RhinoCommon). Either way, there are many topics on Discourse and the old Grasshopper forum that discuss which language to pick, I’d do a search.

4 Likes

Changes to Rhino 8
Rhino finally supports CPython 3.x , interfacing to the NET ecosystem (C#, F#,C++, VB. Net) using a different approach as IronPython. Interfacing to NET is important, because (partially) Rhino and Grasshopper are written in it. Modern Python is great and simple, with a rich set of packages. But that NET interfacing is tricky and hard to understand for beginners. So its still risky, to go for Python in the RH/GH environment because of this. But at least you can now use the full potential, which is a major improvement over IronPython 2.7. Also Python scripts can now be compiled to plugins (.gha)

Rhino utilises NET 7! This allows you to access modern C#. In my opinion C# syntax became a mess.Some changes are good, some are bad, but the ecosystem has improved drastically and you can do more with less code. That is a plus, making modern C# capable to prototype fast as well. But these endless options to write the same code with different syntax can be a problem for beginners. C# is great language for medium to large applications. It is has great debugging and profiling capabilities and performs better.

But overall, there are more similarities than differences. I also advice to be curious and give both a try (for a while). Don’t give up too early. At some point you will use more than 1 language anyways. Currently I use 6 languages on my daily work.

4 Likes

Yikes!