Is Python the new BASIC?
-
Looking into learning it myself (finally), I was reading that Python is becoming much more popular at the high school level, and it has already been well-established as an easy tool to get a lot of stuff done by non-CSC types - which reminds me of the way that classic Visual Basic was used by a lot of folks.
Yeah, it's used in middle school computer science courses too.
Nish Nishant Consultant Software Architect Ganymede Software Solutions LLC www.ganymedesoftwaresolutions.com
-
Looking into learning it myself (finally), I was reading that Python is becoming much more popular at the high school level, and it has already been well-established as an easy tool to get a lot of stuff done by non-CSC types - which reminds me of the way that classic Visual Basic was used by a lot of folks.
I'm may the odd one out, but I count myself lucky not having to deal with this slithering snake. I used to code in VB.NET and I hated it where a _ is required to break a line. Old FORTRAN required to start data or statement with specific column. Old VI editor requires switch toggle insert to edit. This Python requires indentation to mark code block and space to mark line break. It just brings to many of those bad memories to deal with just archaic requirement. I would gladly use {} and ; to state my intention any time.
-
I'm may the odd one out, but I count myself lucky not having to deal with this slithering snake. I used to code in VB.NET and I hated it where a _ is required to break a line. Old FORTRAN required to start data or statement with specific column. Old VI editor requires switch toggle insert to edit. This Python requires indentation to mark code block and space to mark line break. It just brings to many of those bad memories to deal with just archaic requirement. I would gladly use {} and ; to state my intention any time.
That's what baffled me too when I learned Python for the first time. Using indentation to mark code block? That's worse than BEGIN and END keyword! What if I deleted a space accidentally? There will no error message at all. No IDE error. No Compile error. Until some angry user phones me. I would rather leave this thing alone.
-
To be honest, I think this is actually truer: > It is practically impossible to teach good programming to students And I think the fault lies first in the teacher, second in the language. While I could teach good programming in BASIC, I wouldn't really want to, but in fact it is actually easier to teach good programming in a highly constrained language. Now, given "modern" languages with their generics, templates, classes, interfaces, lambda expressions, typeless or typed, etc., features, teaching good programming is harder for the simple reason that nobody actually seems to teach programming principles and then how to apply those principles to a particular language. Instead, they teach the language and then say "oh, you just learned about so-and-so principle." Bassackwards. The result is the experience I see with the junior devs out of college. "Jeez, I wish they had taught me that in school" pretty much anytime I talk about good programming practices.
Latest Article - Building a Prototype Web-Based Diagramming Tool with SVG and Javascript Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802
Well said!
-
That's what baffled me too when I learned Python for the first time. Using indentation to mark code block? That's worse than BEGIN and END keyword! What if I deleted a space accidentally? There will no error message at all. No IDE error. No Compile error. Until some angry user phones me. I would rather leave this thing alone.
Hmm, not strictly true, as you would know if you'd ever used it in anger! 8) Having progressed through FORTRAN/Assembler/Algol60/68R/C/C++ etc, I too was surprised at the use of spacing to delineate blocks of code, but (and especially with a good IDE) it really isn't an issue, and is certainly no worse than the (to me completely daft) Java convention of opening a block at the end of a line, but closing it at the beginning of some random line later on. The number of times I've misread a piece of code because I didn't notice the brace at the end of a long line (yes, I know, my failing!)... Having done extensive dev in Python over some years now, everything from responsive web apps to OS loaders to processing compressed files too large to unpack to disk, in umpteen environments and OSs, I've come to appreciate just how good it is. Like every language it has its quirks and sillinesses, but the indentation isn't really one of them! As always, for most dev, the language is unimportant, its the programming that matters - but you won't convince the religious (language) nutters of that, of course! All IMHO, of course 8)
-
I'm may the odd one out, but I count myself lucky not having to deal with this slithering snake. I used to code in VB.NET and I hated it where a _ is required to break a line. Old FORTRAN required to start data or statement with specific column. Old VI editor requires switch toggle insert to edit. This Python requires indentation to mark code block and space to mark line break. It just brings to many of those bad memories to deal with just archaic requirement. I would gladly use {} and ; to state my intention any time.
-
Edsger W. Dijkstra wrote:
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.
So in that sense, Python is the new BASIC. :sigh:
Ad astra - both ways!
Edsger W. Dijkstra wrote:
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.
It is a poor craftsman who blames the tools for his failures.
-
Looking into learning it myself (finally), I was reading that Python is becoming much more popular at the high school level, and it has already been well-established as an easy tool to get a lot of stuff done by non-CSC types - which reminds me of the way that classic Visual Basic was used by a lot of folks.
There are some technical and historical reasons that BASIC was THE de facto programming language for students and non-professionals for a generation. The main one, in my opinion, is not that the language was so easy (it IS pretty easy, though), but that it WAS (emphasis on "was") so easy to get started. You literally turned on the computer (TRS-80, Commodore 64, etc.) and you had a BASIC prompt. It's now actually harder to get started in programming because there are just so many layers of tools to get going. (There are notable exceptions, but there is no universal simplicity like what was on the home computers of the 1980's.) You CAN write high-quality, well structured software in BASIC (and Python, and you name it). You can also write garbage. I've read thirty-year-old BASIC code and re-written it in C. The original code was impeccably constructed!
-
Hmm, not strictly true, as you would know if you'd ever used it in anger! 8) Having progressed through FORTRAN/Assembler/Algol60/68R/C/C++ etc, I too was surprised at the use of spacing to delineate blocks of code, but (and especially with a good IDE) it really isn't an issue, and is certainly no worse than the (to me completely daft) Java convention of opening a block at the end of a line, but closing it at the beginning of some random line later on. The number of times I've misread a piece of code because I didn't notice the brace at the end of a long line (yes, I know, my failing!)... Having done extensive dev in Python over some years now, everything from responsive web apps to OS loaders to processing compressed files too large to unpack to disk, in umpteen environments and OSs, I've come to appreciate just how good it is. Like every language it has its quirks and sillinesses, but the indentation isn't really one of them! As always, for most dev, the language is unimportant, its the programming that matters - but you won't convince the religious (language) nutters of that, of course! All IMHO, of course 8)
But IDE doesn't have mind reader ability. When we delete some spaces accidentally, at the last line of a code block in particular, how can it know that it was a mistake? How can it know that line of code should be a part of above block, and not simply the next line of execution?
-
But IDE doesn't have mind reader ability. When we delete some spaces accidentally, at the last line of a code block in particular, how can it know that it was a mistake? How can it know that line of code should be a part of above block, and not simply the next line of execution?
As I said, every language has its own quirks. In C type languages accidentally inserting or omitting a semicolon can completely change the meaning of a block of code, and adding/omitting '=' or forgetting a 'break;' can completely screw your conditional statements and an IDE wouldn't know about that either. In Javascript objects assigned from another object are references, not copies; this can be useful, but also makes it very difficult to ensure that data is atomic or immutable when that's necessary (ie code inside a deeply nested function can change apparently unrelated variables by 'remote control' if you are not careful). No language is perfect, and I have indeed had Python code behave unexpectedly due to indentation issues, but this has not been any more of a problem than things like those above, in fact, less. It is very easy to write tests for things in Python (because the language is so versatile) and that catches such things readily. For my web apps I use selenium for testing the 'user' interactions and my own internal tests for the model code. At the end of the day, very domain specific stuff possibly excepted, programming is programming and the language you use irrelevant. You are testing your code, aren't you 8)
-
As I said, every language has its own quirks. In C type languages accidentally inserting or omitting a semicolon can completely change the meaning of a block of code, and adding/omitting '=' or forgetting a 'break;' can completely screw your conditional statements and an IDE wouldn't know about that either. In Javascript objects assigned from another object are references, not copies; this can be useful, but also makes it very difficult to ensure that data is atomic or immutable when that's necessary (ie code inside a deeply nested function can change apparently unrelated variables by 'remote control' if you are not careful). No language is perfect, and I have indeed had Python code behave unexpectedly due to indentation issues, but this has not been any more of a problem than things like those above, in fact, less. It is very easy to write tests for things in Python (because the language is so versatile) and that catches such things readily. For my web apps I use selenium for testing the 'user' interactions and my own internal tests for the model code. At the end of the day, very domain specific stuff possibly excepted, programming is programming and the language you use irrelevant. You are testing your code, aren't you 8)
Really?
var foo = "Hello";
var bar = "World";
var message = foo + " " + bar + "!";I am pretty sure the IDE will throw an error right away if I deleted an ; Compare it to Python:
price = 1100
discount = 50
qty = int(input('How many do you want to buy? '))
total_price = qty * price
if qty > 10:
discount = discount + total_price/100 * 5
total_price = total_price - discount
print(total_price)The IDE won't find out anything if the indentation TAB on 2nd last line is accidentally deleted. But you are right, we should have made unit tests for everything. Only that I got lazy sometimes, especially if it's just a simple function. Ha ha ha.
-
Really?
var foo = "Hello";
var bar = "World";
var message = foo + " " + bar + "!";I am pretty sure the IDE will throw an error right away if I deleted an ; Compare it to Python:
price = 1100
discount = 50
qty = int(input('How many do you want to buy? '))
total_price = qty * price
if qty > 10:
discount = discount + total_price/100 * 5
total_price = total_price - discount
print(total_price)The IDE won't find out anything if the indentation TAB on 2nd last line is accidentally deleted. But you are right, we should have made unit tests for everything. Only that I got lazy sometimes, especially if it's just a simple function. Ha ha ha.
It's easy to find similar examples in any language 8) Javascript: var person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"}; var me = person; me.firstName = "mike"; What does person.firstName hold now? Would an IDE warn you that me was a reference? What if the assignment to firstName is miles away in other code? Compare that with similar code in C++, which by default will make a deep copy of the object so that person and me are not pointers to the same memory. In C: a = 1; b = 1; c = 0; if (a != b); { c = 1; } What value does c hold? I'm not saying a good IDE doesn't help, because it does - but that's true with any language, including Python. You can write bad code in any language (BTDTGTTS!), so my point remains: Python is different, but that doesn't make it better (or worse). You should use the most appropriate tool for the job, and for which you have the most skill. FORTRAN code is (was) position dependent too...