Some time ago, I was given the opportunity to take a free course in Python. I was like “Sure why not? And it’s free? Woot!” (I don’t actually say “woot” but it seems like the kind of thing people say, right?)
The course is a beginner module meant for technical people (but not full-on coders). I was the only professional programmer in the class. I didn’t care, I don’t know Python. So 2 points of interest…
White space is critical
The programming languages I know consider white space as something to make the code easier to read for the human. Python elevates that to a whole new level.
I’m not even talking about the debate about whether a tab or 4 spaces is better for indentation. Python will punish you if you used 4 spaces for indentation here and then use 3 spaces for indentation there. This is especially terrible if you use an editor where a tab looks like 4 spaces so it looks like the indentation is fine but it’s not.
Parameter values are by default passed by reference
This one took a bit of getting used to. I’m used to passing values to functions and knowing that those values (or classes or structs) will never be tampered with unless I say so. For example, with the “ref” keyword in C#:
public void Foobar(ref ComplicatedClass ImComplex)
// ImComplex will possibly be modified
I’ll just slide that into my “good to know, but I’ll probably never use” list. I don’t want any weird errors slithering up because that’s hard to swallow. (I swear that’s the end of my snake jokes)
P.S. Happy Independence Day to you if you celebrate it. Coincidentally, it’s also the official day that my company closed. So Independence Day to me too.