Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Python is EVIL....

Python is EVIL....

Scheduled Pinned Locked Moved The Lounge
python
67 Posts 37 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G glennPattonWork3

    Tried that, is there a switch I missed I couldn't get it to indent properly...

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #21

    Worked right out of the box for me ... I trust you remembered to add the colon at the end of your if, else, elif, while, etc. statements.

    1 Reply Last reply
    0
    • G glennPattonWork3

      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...

      S Offline
      S Offline
      Scott Serl
      wrote on last edited by
      #22

      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.

      1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        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!

        L Offline
        L Offline
        Leng Vang
        wrote on last edited by
        #23

        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."

        1 Reply Last reply
        0
        • G glennPattonWork3

          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...

          M Offline
          M Offline
          megaadam
          wrote on last edited by
          #24

          Yeah! Who cares about whitespace and labels in Assembly!

          ... such stuff as dreams are made on

          Kornfeld Eliyahu PeterK 1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            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!

            R Offline
            R Offline
            Rick York
            wrote on last edited by
            #25

            Darn - just when those memories had nearly vanished, I saw that stuff and it brought back a flood of nastiness. :wtf:

            1 Reply Last reply
            0
            • G glennPattonWork3

              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...

              P Offline
              P Offline
              peterkmx
              wrote on last edited by
              #26

              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:

              D 1 Reply Last reply
              0
              • M MarkTJohnson

                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.

                Kornfeld Eliyahu PeterK Offline
                Kornfeld Eliyahu PeterK Offline
                Kornfeld Eliyahu Peter
                wrote on last edited by
                #27

                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

                "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

                1 Reply Last reply
                0
                • M megaadam

                  Yeah! Who cares about whitespace and labels in Assembly!

                  ... such stuff as dreams are made on

                  Kornfeld Eliyahu PeterK Offline
                  Kornfeld Eliyahu PeterK Offline
                  Kornfeld Eliyahu Peter
                  wrote on last edited by
                  #28

                  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

                  "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

                  1 Reply Last reply
                  0
                  • G glennPattonWork3

                    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...

                    D Offline
                    D Offline
                    DJ van Wyk
                    wrote on last edited by
                    #29

                    glennPattonWork wrote:

                    Winge mode on.

                    You forgot to turn winge mode off again...

                    My plan is to live forever ... so far so good

                    G 1 Reply Last reply
                    0
                    • P peterkmx

                      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:

                      D Offline
                      D Offline
                      Davyd McColl
                      wrote on last edited by
                      #30

                      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.

                      P 1 Reply Last reply
                      0
                      • G glennPattonWork3

                        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...

                        D Offline
                        D Offline
                        Davyd McColl
                        wrote on last edited by
                        #31

                        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!

                        1 Reply Last reply
                        0
                        • D DJ van Wyk

                          glennPattonWork wrote:

                          Winge mode on.

                          You forgot to turn winge mode off again...

                          My plan is to live forever ... so far so good

                          G Offline
                          G Offline
                          glennPattonWork3
                          wrote on last edited by
                          #32

                          Ah, how right you are: Winge mode off.

                          1 Reply Last reply
                          0
                          • G glennPattonWork3

                            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 Offline
                            I Offline
                            ISanti
                            wrote on last edited by
                            #33

                            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

                            1 Reply Last reply
                            0
                            • G glennPattonWork3

                              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...

                              B Offline
                              B Offline
                              Bill McKidd
                              wrote on last edited by
                              #34

                              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.

                              1 Reply Last reply
                              0
                              • G glennPattonWork3

                                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...

                                B Offline
                                B Offline
                                Bob1000
                                wrote on last edited by
                                #35

                                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

                                A 1 Reply Last reply
                                0
                                • L Lost User

                                  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.

                                  M Offline
                                  M Offline
                                  Martijn Smitshoek
                                  wrote on last edited by
                                  #36

                                  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:

                                  L 1 Reply Last reply
                                  0
                                  • M Martijn Smitshoek

                                    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:

                                    L Offline
                                    L Offline
                                    Lost User
                                    wrote on last edited by
                                    #37

                                    No, never seen any of those, not had any problem with IDLE. And I don't quite see how it can reveal your passwords. Maybe you are doing something wrong.

                                    M 1 Reply Last reply
                                    0
                                    • OriginalGriffO OriginalGriff

                                      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!

                                      B Offline
                                      B Offline
                                      BryanFazekas
                                      wrote on last edited by
                                      #38

                                      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 ...

                                      G 1 Reply Last reply
                                      0
                                      • G glennPattonWork3

                                        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...

                                        M Offline
                                        M Offline
                                        M Johansen
                                        wrote on last edited by
                                        #39

                                        Use PyCharm as IDE for Python. But if you want curly braces then switch to Perl. :-D

                                        1 Reply Last reply
                                        0
                                        • G glennPattonWork3

                                          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...

                                          T Offline
                                          T Offline
                                          TWMitchell
                                          wrote on last edited by
                                          #40

                                          Use IDLE for Python programs. Much better than Notepad+++ and it helps resolve the tab issue.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups