Python - a programming language has to be more than a cute name

Uberseehandel
Kind of a big deal

Python - a programming language has to be more than a cute name

To all those devs out there

 

Especially the Meraki and Cisco devs (who have put together some great training material)

 

I have a couple of ideas I want to implement, so not having written anything in python recently, I decided to renew my acquaintance by auditing a couple of courses.

 

Which had me cussin', out loud. If python had been used for the Apollo space program, we would we still be waiting. (They did there, despite Fortran).

 

There must be a special place in hell for Guido van Rossum, and he would not be alone, quite a few well known names will eventually join him there.

 

As somebody who spent time studying comparative languages and design, python makes me wince. Its lack of orthogonality takes one's breathe away, and not in a good way. Plus - weak typing, lack of explicit variable declarations, white space as syntax (foobars cut and paste), everybody has their pet hate to add to the list.

 

At the end of the day, python is too risky to be used on large and critical projects - too easy for errors to slip though testing.

e.g. -

x=0
for ii in range(5):
   ++x
   print(x)

No error message  ++x is parsed as +(+x) which is a no-op.

 

So why are why are we using python in SDN situations?

 

For professional developers a language is a tool, not a qualification. One of the things we learn early on is that the best tools are predictable, and easily verifiable. Python is not the only convenient language.

 

I encounter suggestions that one should prototype in python and then develop in something more appropriate. And how often does that happen?

 

Demonstration code should function correctly even when cut and pasted. 

 

 

Robin St.Clair | Principal, Caithness Analytics | @uberseehandel
13 Replies 13
sauvesean
Here to help

I prefer PowerShell for the Meraki API.

@sauvesean

I am consistently pleasantly surprised by PowerShell, but not for what I intend doing, unfortunately. Thanks for reminding me.

Robin St.Clair | Principal, Caithness Analytics | @uberseehandel
chengineer
Meraki Alumni (Retired)
Meraki Alumni (Retired)

I'm not sure if there is a Meraki question here, but each language (computer or human) has its unique syntax and associated idiosyncrasies. In this case, if you want to increment x in Python, you want x += 1 instead of x++.

Solutions Architect @ Cisco Meraki | API & Developer Ecosystem


@chengineerwrote:

I'm not sure if there is a Meraki question here, but each language (computer or human) has its unique syntax and associated idiosyncrasies. In this case, if you want to increment x in Python, you want x += 1 instead of x++.


I think you have missed the point of my comment. It isn't the how, it is the shiite error handling.

 

The Meraki question is - 

 

Why pick one of the worst designed languages ever to demonstrate the use of the APIs? Why not set a good example? Web developers know no better, but I expect more of Cisco / Meraki.

Robin St.Clair | Principal, Caithness Analytics | @uberseehandel

That's because it's not an error... you got the syntax wrong - the equivalent of hitting the gas in your car and wondering why you accelerated into a light pole. If you don't know how to use something, you're going to have a bad time no matter the quality or utility of whatever it is you're not using correctly.

 

 

Your opinion that it's the "worst language in the world" is by far in the minority and it has become the de facto standard for automation and scripting in the network world. If Meraki hadn't adopted it as the primary language, network engineers wouldn't be using it.

growth_major_languages-1-1400x1200

 

mmmmmmark
Building a reputation

So the idea is that the more questions that are asked about a language, the better it is? An argument could be made for the opposite too.

 

And keep in mind, the last language I coded in was Turbo Pascal so i'm by no means a programmer!

That's a single chart showing the amount of discussion on a topic. You can find the rest here.

 

Python is an easy language to learn (as long as you actually learn how to use it and don't assume syntax from other languages) that is fantastic for data science like analyzing large data sets or quickly processing incoming information. It's quite simple to use when doing basic tasks which is why it's been adopted by the networking industry but can be extended to do some pretty advanced things with a little bit of know-how. It can be interpreted and run in scripts or compiled into full applications - both command-line and graphical. It works across virtually every platform out there in near-identical manners (including mobile platforms). It has a massive open-source community that create modules/libraries to extend the functionality even further and allow the dev to solve their problem without the need to reinvent the wheel every time. The list goes on...

 

The assertion made by the original poster is one of frustration and lack of knowledge/experience with the tools.

 

I also learned Pascal back in the 90's and became a Perl junkie later on... I fought to keep using Perl for the longest time but when I finally started with Python it changed my world and has replaced nearly every other language I was using (I write iOS apps in Swift).

 

That's not to say it's perfect, just that it isn't the garbage language you'd think based on the original post.


@radzima wrote:

That's because it's not an error... you got the syntax wrong - the equivalent of hitting the gas in your car and wondering why you accelerated into a light pole. If you don't know how to use something, you're going to have a bad time no matter the quality or utility of whatever it is you're not using correctly.

 

 

Your opinion that it's the "worst language in the world" is by far in the minority and it has become the de facto standard for automation and scripting in the network world. If Meraki hadn't adopted it as the primary language, network engineers wouldn't be using it. 


My complaint was the error handling, I know the syntax is wrong but proper error handling should have caught the error.

 

The fact that lots of people use a language doesn't make it good. The fact that not many people find it egregiously badly designed doesn't invalidate their opinion. Its hardly surprising that a large number of people find they like it if they are familiar with web development, which is a mess.

 

Your statement that "If Meraki hadn't adopted it as the primary language, network engineers wouldn't be using it", beggars belief. It is a big world out there.

 

As far as Meraki engineers go, some are using NodeRed, obviously not all take your lime-green tinted view of the world of network engineering.

 

A language is a tool, not a skill. People have been designing computer languages for over 70 years, there has been a lot of published work done on desirable language features; None of which appears to have informed the creator of Python.

 

Have you considered that there is a disproportionate number of questions about Python on Stack Overflow because it is so poorly designed and, amongst other factors lacking in orthogonality?

 

 

 

 

Robin St.Clair | Principal, Caithness Analytics | @uberseehandel

You’re still not getting it... there was no error to throw so it didn’t generate one. The syntax you used was incorrect for what you wanted to do but not incorrect syntax. If you wanted to ensure you got the result you wanted, you would need to build your own custom exception handling and check the value.

 

I’m not arguing with you over the virtues of using Python, you’re mind is clearly made up and nothing will change it despite the fact that you’re blaming an entire language that many engineers use daily with great results for your mistake. I’ve been working with Python and APIs for much longer than Meraki has had anything available and anyone that knows me is well aware of my feelings about Meraki. If you want to have a constructive conversation about the shortcomings that exist (which there are many, same as any language) and how to work around them, I’m all for it, but I don’t argue with zealots. 

@radzima

 

Please don't tell me that I am "not getting it". 

 

Your response perfectly illustrates why anybody, with an informed approach, to computer language design finds Python, at best, lacking.

 

I'm not a zealot, I'm a computer scientist. I don't actually care about your opinion, because it is not informed. You have worked with a lousy language for a long time and got used to it. To you, Python is a skill, to many people in the wider world, Python is a tool with marked drawbacks.

 

The fact that you do not find this an acceptable or reasonable viewpoint says more about your skill set than you appear to realise.

Robin St.Clair | Principal, Caithness Analytics | @uberseehandel

If you really are a computer scientist you'd have looked at the API docs and gone from there. It's a simple RESTful API with logical endpoints. You can use whatever language you want. The examples are for those that are still learning programming (maybe you should pick up a book and learn a little too). You made a mistake. You made an error in syntax. You blamed the language for your idiocy.

 

I hope you enjoy your obsolescence as the rest of us learn and adapt to whatever language we want to use.

 

You absolutely, 100% aren't getting it.


@radzima wrote:

If you really are a computer scientist you'd have looked at the API docs and gone from there. It's a simple RESTful API with logical endpoints. You can use whatever language you want. The examples are for those that are still learning programming (maybe you should pick up a book and learn a little too). You made a mistake. You made an error in syntax. You blamed the language for your idiocy.

 

I hope you enjoy your obsolescence as the rest of us learn and adapt to whatever language we want to use.

 

You absolutely, 100% aren't getting it.


@radzima

 

Now you are trolling me. Cut it out.

 

Why you are pointing out that the (Meraki) API is RESTful, is beyond me, it is an irrelevant comment. I did not make an error in syntax. You assumed the example I quoted was a mistake that I had made. That is not true, it was an example to illustrate a point. Predictably assuming sure made an ass out of you.

 

You then go out of your way to be offensive.

 

 

Robin St.Clair | Principal, Caithness Analytics | @uberseehandel
princedirect
New here

I agree with you. I prefer to use JS.

Talking about Python: weak typing, lack of explicit variable declarations, white space as syntax - it's true.

Get notified when there are additional replies to this discussion.