Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • It’s amusing how people twist trains of thought into ridiculous ideas.

    The point of Python’s use of indentation is not that it forces you to write clean code. As you showed, that sort of argument is ridiculous.

    Rather, the impetus behind its use of indentation is that since all good code is properly indented, the language can actually make use of the presence of indentation and thereby relieve you of having to mark blocks up in some visually noisy way.

    I happen to think that this has disadvantages

    • Well, the straw man keeps attacking people in this case.

      Found in some python:

          except NoSectionError:
              # How the fsck do I leave an empty except block?
              xyzzy = 3.14159265

      Sigh... All of this confusion and noise for lack of bacon in the syntax. Of course, I guess he could have read the documentation and found that the one true way to not throw a specific exception is to put 'pass' in the except block. This is where "the one true way" bites

      • What I wrote was not meant as an argument in favour of using indentation to avoid delineation for blocks. I believe that there are many good reasons to denote blocks explicitly.

        All I was saying is that the impetus for using indentation to denote blocks was not to force programmers to indent properly. People should stop wasting their time arguing against a ridiculous straw man. There are plenty of good criticisms to make about the conclusion (that one can rely solely on indentation for syntactic cues) once y

        • The premise that blocks implicitly delimited via indentation "should suffice" is flawed, yes (because we want a programming language to be expressive, and blocks are not just a procedural construct (they are also a primitive (and I like bacon.)))

          Perhaps "forced indentation makes your code better" is indeed some kind of brilliant straw man which prevents the majority of users from realizing that the bacon has gone AWOL?

          Anyway, "straw man bites dog" was maybe not the right way to put it and I'll just assume t

          • There is much more to Python than just this one flaw (disguised as a benefit). I don’t know terribly much about it, but f.ex. I like the __CALL__ (I think) mechanism whereby you can treat an object like a function and “call” it. That gives you some neat ways to do things that in Perl are a lot more cumbersome. The language is also a lot more regular than Perl, which is not always an advantage from a linguistic point of view, but has a strong allure on the people coming at languages from a

            • What does __CALL__ make more convenient? The convenience can't be that big because all you save is slipping a method name.

              Anyways if you need that in Perl, use overload to overload '&{}' and your object can now be called as a function. Or (in a way that is more obvious to the maintenance programmer) you can just use an anonymous function as your object.

              • The convenience is not big, but big enough to matter. This kind of thing is easy in Perl, but effortless in Python.

                Overloading &{} is less convenient: either you pass a function reference, in which case that piece of code has a marked syntactical difference from all your other methods, or you pass a method name, in which case cause and effect are separated (and you need to come up with an extra identifier; plus there’s still lots of extra syntax to set this method apart).

                Another part of the diffe