I never realized the style issue until I got better at writing Python code. Before that, the only languages I knew where Pascal, Visual Basic, Javascript, and C++ - and there is, quite honestly, not much difference in coding style between VB and C++. The possibilities might be different, but the chosen solutions are conceptually the same. After all, they're both Algol-like languages.
It took my a while to figure out why I had such a hard time with larger Python projects: I was trying to design them as Algol-like solutions. Not that Python is completely Lisp-oriented, but once I started to think of tuples as
Forcing good practice or habits from one language into another is not only dumb, it prevents you from writing efficient code. For example, unlike most languages, VB doesn't exit a function when the return value is assigned. Which is convenient, because it allows cleanup before exiting the function (DAO recordsets have a history of leaking when not explicitly closed). If you're unaware of this, or you force yourself do do an exit function immediately after assigning the return value 'because any other language does it this way', then you'll end up with storing the return value in a temporary variable, cleaning up, and returning the temp. value. And probably showing off your ignorance by telling all your 'coderz' friendz how uncool VB is.
No comments:
Post a Comment