Wednesday, April 15, 2020

Python: the BASIC of today

I took a look a Python a decade plus ago. At that time I kinda dismissed it as a toy language as I can do whatever I want in Java without learning another language which almost look just like it without braces.

Year after year if you look at list of popular languages you see Python on very top. See here for example. If you can still go to a bookstore or a library you see many children's book on programming using Python! ..and a lot of them focus even on creating your own games. There are endless camps luring parents to have them teach their kids Python (and charge you a hefty fee).

What makes Python so successful? It is easy to learn. Its got a shell you can run right away, no need to compile and link. It doesn't even require semicolons (but it uses a lot of colons). It comes with a rudimentary IDE called IDLE too. It is cross platform you can make Tkinter windowed apps and many other things. You don't even need to define your variables before you use it. Feels just like BASIC of the 80s.. except you can go crazy with GOTO statements in BASIC. In the 80s there is also the LOGO programming language which is also a Read-Eval-Print-Loop which is kinda fun because you can program that turtle and Python provides that too! There is even a game engine!

Well that appeals to students but what about professionals. It has many math and statistic packages ready to use for some powerful data analyzing. It even has machine learning things that can make "Data Scientists" job much easier. Syntactically it is quite C like except you spell out "and" "or" "not" instead of && || and !. But there are no bottoms of your blocks, indention is needed instead. It can handle lists and sets easily and not as clumsy as java. Given a couple days any C/C++/java developer can pick up its syntax. You can learn right from python.org, and W3Schools is one of many tutorial sites you can read about.

Howevver, it is usually interpreted (not compiled), that means there can be a performance issue and it can be a memory hog. And I really don't like using variables on the fly without even declaring (you can accidentally change a variable already in use too). Ok it can do desktop things what about the web? You CAN do web related stuff and will require extra package such as Django. And oh my gosh, I don't know why Microsoft embrace it so much in Visual Studio. It seems totally abandon its Visual Basic and endorsing Python. I generated a working website with Django like right away with its wizard... it even came with a login page. It works much like ASP/JSP.

Happy coding.

No comments: