|
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.
|
|
|
|
|
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.
Ad astra - both ways!
|
|
|
|
|
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.
|
|
|
|
|
Marc Clifton wrote: 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.
Before we start learning good programming, I would first let them build a single board computer and then let them learn machinne language and implement a simple BIOS themselves.
After that they are ready for a lot more and may actually not be afraid of anything anymore.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
|
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.
|
|
|
|
|
Probably. There are some very good tools available, like Jupyter Notebook which make it really great tool for teaching, all on web. And then there are numpy and other libs making it great tool for math. Good to learn basic concepts.
|
|
|
|
|
Working in the scientific community, Python is well-established and is mainly used as an improvement upon and a cheaper version of IDL. It has some very powerful features and is pretty fast.
However I see it (personally) more as a tool for smaller tasks, than for real software development. For several reasons:
* It's primarely a scripting language
* It's not really OO based, not as java, C++ or C#
* It's kind of hard to get some large, intuitive development out of it
* When having multiple Python versions it's really Hic Sunt Dracones on libraries and environments (see today's xkcd: Python Environment )
A good skill for under your belt, but not the magic they claim it to be.
|
|
|
|
|
That's great! And the mouseover on that xkcd is hysterical. And soooo true. But not just for Python -- for anything *nix!
|
|
|
|
|
When BASIC was cool, yes. BASIC is no longer cool. Python is, especially to get something up and running quickly, leverage a huge code base, write stuff that is actually useful for SBC's, and have cross-platform compatibility.
|
|
|
|
|
Isn't C# cool ?
«... thank the gods that they have made you superior to those events which they have not placed within your own control, rendered you accountable for that only which is within you own control For what, then, have they made you responsible? For that which is alone in your own power—a right use of things as they appear.» Discourses of Epictetus Book I:12
|
|
|
|
|
|
No. It's the old basic in a new wrapper.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Yeah, it's used in middle school computer science courses too.
|
|
|
|
|
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.
|
|
|
|
|
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?
|
|
|
|
|
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.
|
|
|
|
|
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...
|
|
|
|
|
By the way, no more _ required to break a line in VB.Net anymore..
|
|
|
|
|
I know. And like VB _, with enough complaining, perhaps Python will be fixed or at least make optional to allow code block delineation tokens.
|
|
|
|
|
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!
|
|
|
|
|
...where I open up a file to fix a bug in someone else's code and my brain goes WTF, my eye's pop out, I start crying, and I lose all motivation to do anything for the rest of the day.
|
|
|
|
|