Stumbling Fingers

I’m sick of using Perl, the only programming language I have anything approaching fluency in, for everything. So the past couple days I’ve been learning enough Python to take care of a work project with it. The thing that’s been kind of surprising me about it is that I’m finding typing Python code consistently difficult. The language seems to really love lists, which it denotes with [square brackets] - and it uses them for getting at the indices of “dictionaries” too. I thought that Perl had made me learn where most of the ugly characters are on the keyboard, but as it happens I don’t tend to use square brackets much with that language. I’m a pathological hash abuser so the {curly brackets} come very easily to my hands; you’d think the square ones would be easy, since they’re on the Exact Same Keys as the curly ones. But for whatever reason, all them square brackets are cramping my style…

3 Responses to “Stumbling Fingers”

  1. Ezra Cooper Says:

    Square brackets are the only challenge in typing Python for you? Egads. For me the big one is the lack of curly braces which would allow an editor to know how to indent the code for me. But then there’s the mind-boggling fact that you can’t actually do anything within a lambda construction, and the parentheses are all weird. Instead of the (godly) Scheme approach:

    (map (lambda (x y)
    (+ x y))
    my-list your-list)

    or Perl’s similar:

    map { $_[0] + $_[1] } @my_list, @your_list;

    Python requires

    map(lambda (x, y): x + y, my_list, your_list)

    The placement of that colon within the argument, and the lack of a necessity of wrapping the lambda-form in parens… I shake my fist at this languages designer. Which is a shame, because of all that it does right, it has to be frustrating with syntax.

  2. Desultor Says:

    Well, Perl’s syntax is not 100% frustration-free, I’d say :)

    And vim can do some smart indentation with Python code - instead of keying on curly braces, it keys on lines which start with the words, “while” etc., which like to start subblocks. Works just fine!

    My main problem so far is not knowing anyplace like Perl’s CPAN to look at modules and whatnot. But I wouldn’t be surprised to find that something like that exists…

  3. Ezra Cooper Says:

    —- you wrote: —-
    And vim can do some smart indentation with Python code - instead of keying on curly braces, it keys on lines which start with the words, “while” etc., which like to start subblocks. Works just fine!
    —- end of quote —-

    Well, emacs does that too, finding the start of a block, but how to find the end of a block? I have a reflex action which is, after moving a block of text into a while, I start hitting “TAB-downarrow-TAB-downarrow…” epileptically until I see that nothing’s moving, which tells me I’ve corrected all the indentation. For python, it doesn’t know the end of the loop (from the end of its digestive tract) so when I get to the line following the loop, it assumes that line is part of the loop and pulls it underneath.

    I think of these issues as the “ergonomics” of a language and I suspect it’s as serious as physical ergonomics. Over the long run, these issues become really painful!

    Perl’s syntax is counter-intuitive to learn but now that I know it, it’s very comfortable. It’s like breaking in a good pair of hiking boots that are going to last you for years.

    —- you wrote: —-
    My main problem so far is not knowing anyplace like Perl’s CPAN
    —- end of quote —-

    The perl community does seem a bit stronger for the creation, support, and documentation of modules.

Leave a Reply


Protected by AkismetBlog with WordPress