For Teachers...‎ > ‎

Python Programming - tell us what you really think...

There were a number of reasons that I switched programming languages to Python this year.  One of the side benefits (or so I thought) was that it was such an easy language to learn.  I've been teaching it for a couple of months now and I yearn to return to C#.  


One of the advantages that people often mention with Python is that you don't have to use semicolons or squiggly braces.
Come on.
If that is the main selling point for Python then forget it.  The first day of classes with C# I go over the syntax for simple code - just like you use punctuation in English.  I've never found syntax to be a major stumbling block if you have strong readers.  For earlier ages or weak reading skills I turn to block based coding like App Inventor.  On the flip side I've had students stumble through some problems that were simply because they accidentally hit the space bar at the start of a line.


In Python you assign a string as follows:
some_variable = "the string"
However, if you are programming a Windows program using the Tkinter module for python you do it as follows:
some_variable.set("the string")
Now I get the reason for that but it is confusing as heck for a new programmer.  The open source nature of Python results in a wide variety of coding techniques- some are really slick, but some are clunky or not well thought out.
Consistency gets even worse when you consider there are two versions of Python in use - 2.x and 3.x.  Some modules only work with one version!  We are using 3.x and there have been some things that we simply can't do because the module was designed for 2.x.  


With Python you can't overload - now on Stack Overflow there will be lots of python fans who think overloading is ridiculous because you can use multiple parameters.  Yes I can accomplish the same goal in both languages but there are times where overloading is a very useful tool.  If you've ever programmed in Visual Studio you will see the benefit with Intellisense - it is very clear what options you can include when calling a method.  In Pycharms the intellisene functionality is almost useless.  I have to use the help method to determine what parameters to pass and even then it depends on how well the module programmer documented their code.

Easy for simple things, Hard for complex

Creating a desktop app in C# is a breeze.  Try it in Python and you will be pulling out your hair.  There are areas where Python really shines, but there are other areas that are needlessly complex.  In Stack Overflow I saw a poster who bragged that Python was so simple to use that you didn't need an IDE.  Problem is when you've programmed for a while you realize how powerful an IDE can be and how it can make your workflow quicker.  

In closing

I'm glad I chose to teach Python, I think there are many positive aspects of the language.  I would ask that Python fans that post condescending comments about other languages take some serious time to learn another programming language and environment.  I am constantly trying to challenge myself to ensure I'm teaching current languages that will serve students well.  It's been interesting teaching Python and I may teach it again, but I know I'll teach C# again!