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

Python problems...

Scheduled Pinned Locked Moved The Lounge
python
73 Posts 29 Posters 0 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.
  • H honey the codewitch

    I refer to it as "invisible source code" because that's what significant whitespace is. And it's just as stupid as it sounds. How do you debug that which you cannot see? It's risible.

    To err is human. Fortune favors the monsters.

    M Offline
    M Offline
    MarkTJohnson
    wrote on last edited by
    #15

    Considering it was named after the people who gave us the Ministry of Silly Walks, Dead Parrots, and the Argument Sketch, what else would you expect?

    honey the codewitch wrote:

    It's risible.

    Had to look that word up, which caused me to be risible.

    I’ve given up trying to be calm. However, I am open to feeling slightly less agitated. I’m begging you for the benefit of everyone, don’t be STUPID.

    P 1 Reply Last reply
    0
    • G glennPattonWork3

      Hi All, Being strongly encouraged (read forced) to use Python for a test rig. Okay need to get down with Kids etc. but syntactic white space 'align your tabs' (who came up with that, is it 1988, am I using a BBC micro) oh gord!!!:mad:

      C Offline
      C Offline
      Chris Maunder
      wrote on last edited by
      #16

      Ya get used to it ;) (The thing that will do your head in is the error when you keep trying to do !var) Oh, and good luck with PIP. You've got this! :thumbsup::thumbsup:

      cheers Chris Maunder

      G L P 4 Replies Last reply
      0
      • C Chris Maunder

        Ya get used to it ;) (The thing that will do your head in is the error when you keep trying to do !var) Oh, and good luck with PIP. You've got this! :thumbsup::thumbsup:

        cheers Chris Maunder

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

        Oh :bob: I hope so...

        1 Reply Last reply
        0
        • C Chris Maunder

          Ya get used to it ;) (The thing that will do your head in is the error when you keep trying to do !var) Oh, and good luck with PIP. You've got this! :thumbsup::thumbsup:

          cheers Chris Maunder

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

          There just something about **Value, my brain says 'Pointer to a pointer, what witchcraft is this!!!'

          1 Reply Last reply
          0
          • Mike HankeyM Mike Hankey

            OriginalGriff wrote:

            Just don't use Python is my advice!

            Friends don't let friends use Python. I attempted to learn it a few moons back and found the tab-space thing to much of a deterrent.

            PartsBin an Electronics Part Organizer - An updated version available! JaxCoder.com Latest Article: Simon Says, A Child's Game

            P Offline
            P Offline
            PIEBALDconsult
            wrote on last edited by
            #19

            Friends don't let friends use TABs.

            Mike HankeyM 1 Reply Last reply
            0
            • C Chris Maunder

              Ya get used to it ;) (The thing that will do your head in is the error when you keep trying to do !var) Oh, and good luck with PIP. You've got this! :thumbsup::thumbsup:

              cheers Chris Maunder

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

              Never had a problem yet with pip. ;P I did say "yet", which probably means trouble the next time I use it.

              C 1 Reply Last reply
              0
              • K Kenneth Haugland

                It is scripted so it's slower than .NET code. And the UI? :~

                T Offline
                T Offline
                theoldfool
                wrote on last edited by
                #21

                There's Codon for that: [^]Python-based compiler achieves orders-of-magnitude speedups | MIT News | Massachusetts Institute of Technology[^]

                >64 Some days the dragon wins. Suck it up.

                T 1 Reply Last reply
                0
                • P PIEBALDconsult

                  Friends don't let friends use TABs.

                  Mike HankeyM Offline
                  Mike HankeyM Offline
                  Mike Hankey
                  wrote on last edited by
                  #22

                  Absolutely Tab[^]

                  PartsBin an Electronics Part Organizer - An updated version available! JaxCoder.com Latest Article: Simon Says, A Child's Game

                  1 Reply Last reply
                  0
                  • H honey the codewitch

                    I refer to it as "invisible source code" because that's what significant whitespace is. And it's just as stupid as it sounds. How do you debug that which you cannot see? It's risible.

                    To err is human. Fortune favors the monsters.

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

                    OK, "risible" ... thanks, never heard of it :-)

                    A 1 Reply Last reply
                    0
                    • D David Crow

                      glennPattonWork3 wrote:

                      ...but syntactic white space 'align your tabs'

                      It's like COBOL or RPG. X|

                      "One man's wage rise is another man's price increase." - Harold Wilson

                      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                      "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

                      D Offline
                      D Offline
                      Dan Neely
                      wrote on last edited by
                      #24

                      David Crow wrote:

                      glennPattonWork3 wrote:...but syntactic white space 'align your tabs'It's like COBOL or RPG. X|

                      With 1 very important difference. With only assembler to build from and the extremely limited capabilities of computers when those languages were designed, rigid assignment of columns of code for specific purposes wasn't an unreasonable choice to make things easier for the compiler and compiler authors and was a major step forward from the prior state of the art. The chuckle:elephant:s guilty of designing python have no such excuse.

                      Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius

                      T 1 Reply Last reply
                      0
                      • OriginalGriffO OriginalGriff

                        Most editors can, but they tend to default to "use tabs" to save file space. And some only do it for modified lines, and ... it's a mess. Just don't use Python is my advice! :laugh:

                        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

                        T Offline
                        T Offline
                        trønderen
                        wrote on last edited by
                        #25

                        OriginalGriff wrote:

                        Most editors can, but they tend to default to "use tabs" to save file space.

                        To save file space??? You (or rather, those you refer to) can't be serious. In year 2023, you do not seriously use a tab character to save three (3) bytes of space! My home PC has two 16 TB disks, one 8 TB and one 1 TB M.2 main disk - that is almost 14 trillion (English - that is 'billion' in many other countries) times the space a tab character will save. My home PC certainly has got more disk space than most home PCs. Not only have I been using digital video cameras since they came to the market - I imported one from abroad before they were introduced in Norway - but I also have had all my old video, Super-8 and old 8mm digitized. Yet, disk capacities are generally stated in terabytes nowadays. If you need to save 3 bytes of space here, 3 bytes there, then I guess you also need to rule out file systems that allocate disk blocks of 4 Ki size; 512 bytes would be the maximum acceptable. Maybe you should go down to the old floppy disk standard of 128 byte sectors ... Even 512 bytes rules out NTFS, but I guess you could use some FAT variant. I am not familiar with all 42 Linux file systems, but I'd be surprised if not at least a few of them can be configured for 128 bytes allocation unit. If you worry about a waste of 3 bytes for a source file indent, you will probably want to use 128 bytes units.

                        1 Reply Last reply
                        0
                        • D Dan Neely

                          David Crow wrote:

                          glennPattonWork3 wrote:...but syntactic white space 'align your tabs'It's like COBOL or RPG. X|

                          With 1 very important difference. With only assembler to build from and the extremely limited capabilities of computers when those languages were designed, rigid assignment of columns of code for specific purposes wasn't an unreasonable choice to make things easier for the compiler and compiler authors and was a major step forward from the prior state of the art. The chuckle:elephant:s guilty of designing python have no such excuse.

                          Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius

                          T Offline
                          T Offline
                          trønderen
                          wrote on last edited by
                          #26

                          Dan Neely wrote:

                          The chuckle[mastadon] s guilty of designing python have no such excuse.

                          I was there when C pushed out Pascal (and Algol and Simula and ...). Lots of programmers argued in favor of C because they hated all the typing of BEGIN and END (and in some languages CASE - ESAC, DO - OD and PROCEDURE - ERUDECORP). I met lots of programmers who insisted that replacing keywords with braces speeded up their programming. Besides, they argued: All those keywords clutter up the program code. C, using braces for delimiters, is much cleaner, they insisted. Python is just taking this one step further. Why should you have to type a delimiter, if you indent the code? Why clutter up you code with braces? Besides: Using both delimiters and indentation opens for inconsistencies: You could be using a brace without indenting, and the reader might overlook it, or indenting without a brace, leading the reader to think that the indented code makes up a block. If you use indentation only, you avoid such problems. That is how the arguments go. Most modern programmers never wrote a compiler, not even a parser, an in any case, using indents for identifying blocks is not, and has never been, a resource saver. So that argument is never heard. I hope that I do not appear as if I am supporting these arguments! I am certainly not. I am much in favor of making structures very explicit. I want the compiler to check that redundant elements (like indent and textual markers) correspond, and to check that the label on the block close matches than of the block opening. I am definitely not a Python lover.

                          P 1 Reply Last reply
                          0
                          • T theoldfool

                            There's Codon for that: [^]Python-based compiler achieves orders-of-magnitude speedups | MIT News | Massachusetts Institute of Technology[^]

                            >64 Some days the dragon wins. Suck it up.

                            T Offline
                            T Offline
                            trønderen
                            wrote on last edited by
                            #27

                            You rarely if ever find a Python supporter who will agree that some other compiled language is orders-of-magnitude faster than Python. Yet, when Python is compiled, it is speeded up by orders-of-magnitude. The only logical conclusion is that compiled Python is way faster than any other compiled language. Believe it if you want to.

                            1 Reply Last reply
                            0
                            • T trønderen

                              Dan Neely wrote:

                              The chuckle[mastadon] s guilty of designing python have no such excuse.

                              I was there when C pushed out Pascal (and Algol and Simula and ...). Lots of programmers argued in favor of C because they hated all the typing of BEGIN and END (and in some languages CASE - ESAC, DO - OD and PROCEDURE - ERUDECORP). I met lots of programmers who insisted that replacing keywords with braces speeded up their programming. Besides, they argued: All those keywords clutter up the program code. C, using braces for delimiters, is much cleaner, they insisted. Python is just taking this one step further. Why should you have to type a delimiter, if you indent the code? Why clutter up you code with braces? Besides: Using both delimiters and indentation opens for inconsistencies: You could be using a brace without indenting, and the reader might overlook it, or indenting without a brace, leading the reader to think that the indented code makes up a block. If you use indentation only, you avoid such problems. That is how the arguments go. Most modern programmers never wrote a compiler, not even a parser, an in any case, using indents for identifying blocks is not, and has never been, a resource saver. So that argument is never heard. I hope that I do not appear as if I am supporting these arguments! I am certainly not. I am much in favor of making structures very explicit. I want the compiler to check that redundant elements (like indent and textual markers) correspond, and to check that the label on the block close matches than of the block opening. I am definitely not a Python lover.

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

                              It seems to be logical that adding these { } to Python with the same semantics as in C would save Python from a lot of criticism ... Like in Cython, where static typing has been added. AFAIK there is also syntax in Python to indicate variable types, but there is nothing done yet with this weird block structure ... :-). Is this feasible (?), perhaps not ... I am dreaming about Python 4.x with { } :-) it's TIOBE rating would probably skyrocket ...

                              FreedMallocF 1 Reply Last reply
                              0
                              • C Chris Maunder

                                Ya get used to it ;) (The thing that will do your head in is the error when you keep trying to do !var) Oh, and good luck with PIP. You've got this! :thumbsup::thumbsup:

                                cheers Chris Maunder

                                P Offline
                                P Offline
                                PIEBALDconsult
                                wrote on last edited by
                                #29

                                Chris Maunder wrote:

                                good luck with PIP

                                Peripheral Interchange Program? I haven't used that since my PDP-11 days.

                                1 Reply Last reply
                                0
                                • P peterkmx

                                  It seems to be logical that adding these { } to Python with the same semantics as in C would save Python from a lot of criticism ... Like in Cython, where static typing has been added. AFAIK there is also syntax in Python to indicate variable types, but there is nothing done yet with this weird block structure ... :-). Is this feasible (?), perhaps not ... I am dreaming about Python 4.x with { } :-) it's TIOBE rating would probably skyrocket ...

                                  FreedMallocF Offline
                                  FreedMallocF Offline
                                  FreedMalloc
                                  wrote on last edited by
                                  #30

                                  As trønderen stated above, with braces whitespace becomes more or less immaterial and so it is, for the most part, with Java, C#, C, C++, etc. And that leads to not having to indent when structuring your code. I was always led to believe that one of the reasons Python made whitespace significant was to enforce "proper" code structure and now all those ugly 2-finger-typed brace characters can be eliminated. In a sense, they actually are there, they're just invisible - and therein lies the rub (at least to braceophiles like me).

                                  P 1 Reply Last reply
                                  0
                                  • L Lost User

                                    Never had a problem yet with pip. ;P I did say "yet", which probably means trouble the next time I use it.

                                    C Offline
                                    C Offline
                                    Chris Maunder
                                    wrote on last edited by
                                    #31

                                    You've not had the: Package A needs version < X of Package B Package C needs version > X of package B Package D needs Package A and Package C /bangs head on desk

                                    cheers Chris Maunder

                                    1 Reply Last reply
                                    0
                                    • Mike HankeyM Mike Hankey

                                      Agreed but with intelligent Python editors why can't they convert between white space and tabs? 4 spaces = 1 tab

                                      PartsBin an Electronics Part Organizer - An updated version available! JaxCoder.com Latest Article: Simon Says, A Child's Game

                                      P Offline
                                      P Offline
                                      PIEBALDconsult
                                      wrote on last edited by
                                      #32

                                      I use two SPACEs per TAB. The simple IDE I wrote can do it, even were I ever to use it for Python. On the other hand, a TAB-stop should be a certain width (e.g. a half inch), regardless of font and display medium, not measured in "character positions". If we could have that, then maybe TABs would make sense.

                                      1 Reply Last reply
                                      0
                                      • OriginalGriffO OriginalGriff

                                        Most editors can, but they tend to default to "use tabs" to save file space. And some only do it for modified lines, and ... it's a mess. Just don't use Python is my advice! :laugh:

                                        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

                                        P Offline
                                        P Offline
                                        PIEBALDconsult
                                        wrote on last edited by
                                        #33

                                        OriginalGriff wrote:

                                        "use tabs" to save file space

                                        I'm quite certain that isn't the reasoning. I think some TABophiles use TABs to save keystrokes. I, of course, use two SPACEs per TAB and otherwise a whole :elephant:ing load of whitespace, vertical space in particular. I am not interested in "saving space" or "saving keystrokes" I need space so I can read the stuff. The simple IDE I developed for myself defaults to TABs because there is no reasonable number of SPACEs to use as a default instead. But what can save file space is that it right-trims SPACEs from lines when it saves a file -- that eliminates a lot more characters from saved files than using TABs.

                                        H C J 3 Replies Last reply
                                        0
                                        • G glennPattonWork3

                                          Hi All, Being strongly encouraged (read forced) to use Python for a test rig. Okay need to get down with Kids etc. but syntactic white space 'align your tabs' (who came up with that, is it 1988, am I using a BBC micro) oh gord!!!:mad:

                                          J Offline
                                          J Offline
                                          jmaida
                                          wrote on last edited by
                                          #34

                                          Using a programming language named after a snake (a constrictor, no less) is maybe a sign. "the devil made me do it" I do not use python for the reasons mentioned (invisible code, tab and space blindness, etc.) I do use other's python code as pseudo code, of sorts, for C.

                                          "A little time, a little trouble, your better day" Badfinger

                                          G 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