Thanks for the reply Zhuangja777, I will consider this when I start learning either of the language. May be I will take a look at similar codes and then decide which is more readable friendly.
Thank you so much for sharing this resource Seghier Will look into it right away.
I’m not using a Mac, but AFAIK, Grasshopper C# scripts do work on Mac.
C# has been ported to the Mac too.
( Just like the Python implementation currently used in Rhino (and Grasshopper) has been ported to Windows/.NET, but … so to speak in the opposite direction )
There are definitely similarities between C# and Python.
Both use a C-like syntax and are imperative languages. But they work in somewhat different ways when looking at how data types are handled by the programmer.
I think I should not call Python’s syntax C-like … maybe C-derived.
The details are often different … sorry.
In C# variables and their types have to be declared in advance, then you can use them,.
Python is a so called dymanic language. You just start using variables and putting data into them
without declaring anything before.
Python is a classical scripting language: you can very quickly write a simple script without worrying in advance about variables and types. (But it’s flexible enough to let you organize things if you need).
C# is a typed, compiled language. It’s organized from the ground up for programs on any size, even very large and complex ones.
But obviously you can use it for scripting … e.g. Grasshopper
To summarize, I’d say smooth enough, even though not completely straitforward.
… I’ve read somewhere that polyglot people say that learingn the first 5 or 6 languare is harder, but after that the task becomes somewhat easier.
I’d say this also applies to programming languages. The more you learn (at least a little ), the easier you will find learning one more.
I dont’ know about C#, sorry.
For Python you might start from the official tutorial The Python Tutorial — Python 2.7.18 documentation
Dont’ worry too much about the language release. Rhino/Grasshopper currently uses Python 2
( But I read here on the forum that Rhino 8 might be able to use Python 3, don’t kwon about Grasshopper 2 ).
Anyway if you learn Python 2, you will have no problem at all with Python 3, they are very similar, Python 3 just let you do more things.
A book for Python as first language might be this one;
I find it a little too verbose, but that’s just my opinion.
The linked book is for Python 3, but it’s a pretty old Python 3, not much different from Python 2.
Or maybe you might be able to find a Python 2 version of the book …
Thanks again for the reply Anders. I agree unless we know context and requirements, learning is meaningless.
Personally, I want to make my design process faster and help me in the fabrication process of design. That is why I want to learn coding and sometimes use it for Generative art. But definitely understand your point, thank you for sharing that snip from the post
It’s your prediction, or there is some information about that possibility?
Grasshopper alone is already allowing you to program some things. Learning another language will make it even better. What I found disturbing: because Grasshopper doesn’t cover all things you do with Rhino document,
you might want to use your new power in the Rhino environment. You can easily use Python to do that, but how about direct use of C# (not by making plugins)?
Can somebody more knowledgeable than me, write about that?
And how about choosing the right language to use Grasshopper but to establish a connection with other software? Like Blender, Revit, QGis, Unreal Engine, etc.?
Steve Baer said that, if I got it right … I don’t remember where exactly, sorry.
@barden00 I think it was here, at the end of Steve’s post.
Be prepared for some pain for that one. As a certain hitman said: there’s 2 kind of pains. The pain that hurts and the pain that alters. Choose wisely.
Metaphor of the day : if you want to be on high demand some time in the future … avoid drifting (i.e. flirting): just marry and be a happy bunny.
Wow that’s a super detailed response. Thank you very much Emilio.
That’s good to know that Python and C# work on windows and mac. Nice, so from what I understand apart from calling out variables, for simple coding python is better and for more complex C# better (hope I am right)
Definitely agree with this one, just the starting problem
Thank you for sharing the resource on Python and explaining on which version Rhino and Grasshopper work. Learning a lot about the technical aspects which I never looked into.
Thank you again.
True, I think the pain will first hurt and then alter
Nice metaphor, so choose one and stick with it
See this crystal ball? Outlines the AEC practice of the future. Everyone knows a thing or two about coding (meaning that he knows nothing). So … why pay him more than the rest?
Moral: If you want to drive that yellow Lambo you should become King of the hill.
True, I think the future is very close. I see many who have started taking interest in coding.
But you are definitely right, need to be the best to drive that lambo (White or Carbon for me)
All black also will certainly do
Meanwhile reading it inside Renault Twingo
If you want to learn C#, I have found nowhere better than Parametric Camp:
(Just in case it got lost in that fantastic list that Baris shared)
My experience is that it is better to learn Python first due to (1) its rich, easy to use functions and data structures (2) simple syntax (less typing) (3) few variable declarations. Then if you need more performance, you can call procedures in C++ (fastest) or C# (more pre-defined functions and data structures).
Writing and debugging a Python program is significantly faster than in C# or C++ so you can quickly get something working. It is much more rewarding to have working code that you can improve than spending so much time trying to fix the many more possible compiler and execution-time bugs in C# or C++. I do have over 10,000 lines of high-performance C++ code in Rhino so it is useful at times but I have more than 100,000 lines in Python.
Writing C# or C++ code from scratch is like playing in the dirt; you have access to all the riches of the earth but you have to deal with all its myriad bits and pieces with perfect declarations and syntax. Writing Python code is like hiring sub-contractors to take care of the implementation details which goes much faster for code development but much slower for code execution. By using both you get the best of both worlds, speedy code development and fast execution. And I find that I can push much of my Python code into C++ or C# by copy and paste plus a few syntax changes. Thus my methodology is to develop everything in Python first and then push the performance-critical code into C++ or C#.
PS After 53 years of programming in a dozen different languages, Python is my favorite.
Although a lot of important things had been said I like to add some more points. The language itself is one aspect, the other is how you efficiently write code and learn a new technologies .And a lot of this is not language specific, not even exclusively related to programming.
In almost 15 years of coding, I dealt with a lot of languages and technologies. And the more you work with it, the more similarities you spot.
Although I also believe the better choice for RH/GH is C#, I definitely believe it doesn’t matter in the end. And this has to do with the fact that you need to know how to use library code, how to log, debug and profile code, how to deal with exceptions and edge cases. How to abstract logic into self-explaining code and how to document properly. It begins with a careful planning, and ends with great attention to detail in the end.
Readability in the end is more a question of proper naming, consistency and code-structure, than of grouping logic by indent (Python) or Curly braces (C#). So all these ‘language X’ is easier to learn/read are pointless if writers are not able to express their ideas. And yes, you can write code that you can’t read 2 weeks later…
Thank you so much for the resource Acichocki1
Thank you so much for the reply Terry.
Firstly, hats off to you for programming for 53 years and thank you for this detailed overview on Python, C++ & C# and it’s reference to sub-contractors and dirt, made it easy to understand the difference between the languages.
I was almost certain to start learning C# but reading this, Python sounds really tempting. I also agree with you about the rewarding part, it is crucial and that is why I left coding half way. I think I will start learning Python as majorly it is easy to use as most commented here. Then if I need performance enhancement, I will look into C# or C++.
I genuinely thank you again for this detailed reply.