Python is EVIL....
-
Tried that, is there a switch I missed I couldn't get it to indent properly...
-
Hi All Winge mode on. I have spent more time than I like to admit fighting with Python today who on good earth though white spaces should be syntax! OK, I came from a C/Assembly background curly braces win not spaces... It's odd plain odd! :wtf: I am going to start using Notepad++ as I at least have a chance of keeping tabs and or spaces in line. I don't like it it might be different if you are introduced from the word go, but I can see People being taught with it being very picky and it making you layout code better but...
It's very important to set your editor for "convert tabs to spaces" or whatever the setting is for your editor so you don't accidentally mix the two.
-
Sort of: it was intended for punch cards, so in the early days specific columns had specific meanings. This explains it well: fortran - Why does COBOL have to be indented? - Stack Overflow[^] FORTRAN had similar: Column 1 indicated a comment if it held a C or a *, columns 1-5 were labels, 6 allowed a line to continue from the previous one. But ... it removed all whitespace outside strings before compilation. And since it didn't require variable declaration (the type of a variable depended on the first letter in its name):
DO 100 i = 1, 10
Was VERY different from
DO 100 X = 1. 10
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!
FORTRAN and COBOL, I can forgive. They were beginning to shape the programming world. Python on the other hand I can not forgive. This is the information age, it supposes to shake off those silliness. Admittedly no language is perfect. But when I look at some languages I had to scratch me head in disbelieve "What the heck?" Those times it always bring back memory of past Minnesota Governor Jesse Vantura's comments about St. Paul road system "They must've been designed by drunken Irish."
-
Hi All Winge mode on. I have spent more time than I like to admit fighting with Python today who on good earth though white spaces should be syntax! OK, I came from a C/Assembly background curly braces win not spaces... It's odd plain odd! :wtf: I am going to start using Notepad++ as I at least have a chance of keeping tabs and or spaces in line. I don't like it it might be different if you are introduced from the word go, but I can see People being taught with it being very picky and it making you layout code better but...
-
Likewise: but mine was even worse, because it used a preprocessor (it was the source for the preprocessor) to provide a "structured programming" approach to FORTRAN called ROOTS[^] - I worked for Rob for six months back in the day as part of my university industrial training. And I still use the flowcharting methods for software design ... :laugh:
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!
-
Hi All Winge mode on. I have spent more time than I like to admit fighting with Python today who on good earth though white spaces should be syntax! OK, I came from a C/Assembly background curly braces win not spaces... It's odd plain odd! :wtf: I am going to start using Notepad++ as I at least have a chance of keeping tabs and or spaces in line. I don't like it it might be different if you are introduced from the word go, but I can see People being taught with it being very picky and it making you layout code better but...
Thanks for bringing this up ... my impression was exactly the same a few years ago when I tried to learn Python "for fun" (having C++/C# background). Luckily I did not need it for a project so I comfortably :) have given up ... Perhaps Python is meant for people without programming background ... :confused:
-
You don't remember COBOL? It had positional stuff too. Didn't it? That was one class a LONG time ago. Also remember WHY it's called Python. Some of their stuff was extremely silly.
COBOL is pure beauty... Coding challenge: is a point in a polygon?[^]
"The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge". Stephen Hawking, 1942- 2018
-
Yeah! Who cares about whitespace and labels in Assembly!
... such stuff as dreams are made on
It is beutyful in any way you look at... Code challenge: greatest common denominator[^]
"The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge". Stephen Hawking, 1942- 2018
-
Hi All Winge mode on. I have spent more time than I like to admit fighting with Python today who on good earth though white spaces should be syntax! OK, I came from a C/Assembly background curly braces win not spaces... It's odd plain odd! :wtf: I am going to start using Notepad++ as I at least have a chance of keeping tabs and or spaces in line. I don't like it it might be different if you are introduced from the word go, but I can see People being taught with it being very picky and it making you layout code better but...
glennPattonWork wrote:
Winge mode on.
You forgot to turn winge mode off again...
My plan is to live forever ... so far so good
-
Thanks for bringing this up ... my impression was exactly the same a few years ago when I tried to learn Python "for fun" (having C++/C# background). Luckily I did not need it for a project so I comfortably :) have given up ... Perhaps Python is meant for people without programming background ... :confused:
No, Python is meant for people who want to get stuff done without having to debate brace layout and other trivialities. It's quicker to get simple stuff done than C/C++ (for one, you don't have to recompile). It can be extended with C/C++ if you think you have a performance need. If you think Python is for non-programmers, you may be disappointed to find that it's exactly for you.
-
Hi All Winge mode on. I have spent more time than I like to admit fighting with Python today who on good earth though white spaces should be syntax! OK, I came from a C/Assembly background curly braces win not spaces... It's odd plain odd! :wtf: I am going to start using Notepad++ as I at least have a chance of keeping tabs and or spaces in line. I don't like it it might be different if you are introduced from the word go, but I can see People being taught with it being very picky and it making you layout code better but...
It takes a bit of getting used to. Then after a while, it's like your eyes are opened -- if whitespace is the block delimiter, there can no longer be wars about where to put those braces. There can no longer be wars about indentation levels. All code in a codebase becomes slightly more unified and people can focus on solving problems -- which Python does extremely well -- instead of trying to assert some rule they had hammered into them at some previous point in their life. As an exercise, try open up other people's Python. Go have a look at software written in Python which is installed on, say, many Linux boxes. Go learn the "Pythonic" way to do things (there are language features which make the structure easier to conform to and which help to unify the flow of process). Now, with your eyes opened, go back to C++, Javascript, C#, wherever. And recognise the burden that Python took from you. I'm not pulling this out of my ass. Python is only one of about 20 languages I've coded in, with varying degrees of proficiency and utility. But I still recommend Python as the ideal learner language because: - it reads well (easy to understand what you or someone else wrote) - the language enforces a reasonable style - it's easy to get simple things done - it doesn't run out of steam when you no longer wish to just get simple things done (it's powerful in itself and there are myriad free libraries out there which are easy to install and consume) - it runs just about everywhere - there are a mad number of good, free (and non-free) editors / IDEs for it (check out PyCharm Edu if you want a good editor and a tutor) - SNAKE!
-
glennPattonWork wrote:
Winge mode on.
You forgot to turn winge mode off again...
My plan is to live forever ... so far so good
Ah, how right you are: Winge mode off.
-
Hi All Winge mode on. I have spent more time than I like to admit fighting with Python today who on good earth though white spaces should be syntax! OK, I came from a C/Assembly background curly braces win not spaces... It's odd plain odd! :wtf: I am going to start using Notepad++ as I at least have a chance of keeping tabs and or spaces in line. I don't like it it might be different if you are introduced from the word go, but I can see People being taught with it being very picky and it making you layout code better but...
I've been there myself. At first I thought that indenting with spaces is a great idea that frees us from using curly braces, etcetera, but my first day of Phyton programming, I realized that using spaces to indent is a nightmare... at least for c-style language programmers. Overall, I didn't feel that the advantages offered by Phtyton were worth the effort, and Phyton is not one of my target languages (although sometimes I've been forced to program a language gateway between Phyton and c#). The lesson for all c-style programmers is that they have to add the cost of getting used to indent with spaces to the Phyton learning curve.
Sorry for my bad English
-
Hi All Winge mode on. I have spent more time than I like to admit fighting with Python today who on good earth though white spaces should be syntax! OK, I came from a C/Assembly background curly braces win not spaces... It's odd plain odd! :wtf: I am going to start using Notepad++ as I at least have a chance of keeping tabs and or spaces in line. I don't like it it might be different if you are introduced from the word go, but I can see People being taught with it being very picky and it making you layout code better but...
If formatting is your biggest complaint, you're blaming your tools for your inadequacy. I use Eclipse which automatically converts tabs to spaces, and yes a macro in Notepad ++ to trim trailing white space, convert tabs to space and save. Stop whining and learn the language.
-
Hi All Winge mode on. I have spent more time than I like to admit fighting with Python today who on good earth though white spaces should be syntax! OK, I came from a C/Assembly background curly braces win not spaces... It's odd plain odd! :wtf: I am going to start using Notepad++ as I at least have a chance of keeping tabs and or spaces in line. I don't like it it might be different if you are introduced from the word go, but I can see People being taught with it being very picky and it making you layout code better but...
Way too many languages designed by way too many Bjarne Stroustrup wannabe's (but without the skill) We need a massive cull of languages and there should be no space for ones like Python..... Computer languages are becoming like normal language, way too many and defended on the most irrational grounds and too the death. Like welsh - its only real use is to confuse tourists and make very long road signs
-
glennPattonWork wrote:
I am going to start using Notepad++
Use IDLE (the Python IDE) and its associated editor, it does all the spacing for you.
Richard MacCutchan wrote:
it does all the spacing for you
And reveal all the passwords you're trying to enter And fight with matplotlib over cpu time I can't count the number of ppl not believing me when I told them that IDLE was causing their problems. I even made some relaunch code, just to make my Python scripts escape from IDLE's claws :( :sigh:
-
Richard MacCutchan wrote:
it does all the spacing for you
And reveal all the passwords you're trying to enter And fight with matplotlib over cpu time I can't count the number of ppl not believing me when I told them that IDLE was causing their problems. I even made some relaunch code, just to make my Python scripts escape from IDLE's claws :( :sigh:
-
Sort of: it was intended for punch cards, so in the early days specific columns had specific meanings. This explains it well: fortran - Why does COBOL have to be indented? - Stack Overflow[^] FORTRAN had similar: Column 1 indicated a comment if it held a C or a *, columns 1-5 were labels, 6 allowed a line to continue from the previous one. But ... it removed all whitespace outside strings before compilation. And since it didn't require variable declaration (the type of a variable depended on the first letter in its name):
DO 100 i = 1, 10
Was VERY different from
DO 100 X = 1. 10
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!
OriginalGriff wrote:
Sort of: it was intended for punch cards, so in the early days specific columns had specific meanings.
I can't believe you mentioned this! You set my therapy back decades! :laugh: Funny story: my freshman year of college we submitted programs on punchcards. During the first class of the first course, we were warned to buy a wide marker. Type your deck, line the cards up neatly, then draw a diagonal stripe across the top of the deck. If the deck got out of order the stripe could be used to visually fix the order of the deck. Also use at least 2 rubber bands to hold the deck together, in case one broke. If we had to make significant revisions to the program, the top could get messy with multiple stripes, but the manual labor of producing a deck made us better, more careful programmers. That and having 12 hour turnaround times on program runs near the end of the semester -- we could not afford to be sloppy at all. [It also made us accurate typists -- miss a stroke, throw out that card] It's end of the semester and nearing midnight. I had dropped off my deck at noon and had walked across campus to pick up the deck + printout. My run had been successful so I got to sleep! ;P Guy is walking towards me, carrying a deck of at least 300 cards. He drops the deck, the single rubber band breaks, and cards spray every where. No sign of a stripe on the top of the deck. Poor guy looks like he's going to cry. He starts to get down on his knees to pick up the deck, straightens up, shakes his head, and walks away ...
-
Hi All Winge mode on. I have spent more time than I like to admit fighting with Python today who on good earth though white spaces should be syntax! OK, I came from a C/Assembly background curly braces win not spaces... It's odd plain odd! :wtf: I am going to start using Notepad++ as I at least have a chance of keeping tabs and or spaces in line. I don't like it it might be different if you are introduced from the word go, but I can see People being taught with it being very picky and it making you layout code better but...
Use PyCharm as IDE for Python. But if you want curly braces then switch to Perl. :-D
-
Hi All Winge mode on. I have spent more time than I like to admit fighting with Python today who on good earth though white spaces should be syntax! OK, I came from a C/Assembly background curly braces win not spaces... It's odd plain odd! :wtf: I am going to start using Notepad++ as I at least have a chance of keeping tabs and or spaces in line. I don't like it it might be different if you are introduced from the word go, but I can see People being taught with it being very picky and it making you layout code better but...
Use IDLE for Python programs. Much better than Notepad+++ and it helps resolve the tab issue.