Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Perl fan being tempted with Python

by MonkOfAnotherSect (Sexton)
on Jun 22, 2005 at 08:26 UTC ( [id://468939]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl fan being tempted with Python
in thread Perl fan being tempted with Python

Python only has semantic initial whitespace - most people find that it stops being painful after an hour or so. Unlike Ruby (at least it did the last time I looked) it doesn't have semantic whitespace in the middle of lines... If you don't want to pass spaces in on the command line, use "\t" instead.

2.1 (with nested scopes) has been out since 2001.

Your complaint about trailing commas being context dependent is just... silly. If you've a one element tuple, most people will wrap it in brackets for clarity.

Except in a few specific cases, named functions are preferred to lambdas. You can have perfectly good named closures, just not perfectly good anonymous ones (you can do anything using lambdas, but the end result is pretty disgustingly unreadable).

Blocks won't exactly be rubyish - they're to simplify resource allocation and release, and won't be used everywhere the way that ruby's blocks are.

That said, I think it's fair to say that more Perl programmers will prefer Ruby to Python.

Replies are listed 'Best First'.
Re^3: Perl fan being tempted with Python
by adrianh (Chancellor) on Jun 24, 2005 at 00:59 UTC
    Python only has semantic initial whitespace - most people find that it stops being painful after an hour or so.

    Indeed.

    Unlike Ruby (at least it did the last time I looked) it doesn't have semantic whitespace in the middle of lines...

    Where does Ruby have this? Never noticed it myself (which may be more of a comment on my observational skills ;-)

    Your complaint about trailing commas being context dependent is just... silly. If you've a one element tuple, most people will wrap it in brackets for clarity.

    Well, not silly exactly. While much Python is laudably clear, I also find the trailing comma convention for print/tuples vexing. Most languages train you to treat trailing commas as semantically insignificant. It took a long time to persuade my eyes to notice them in Python.

    No more annoying than many things in Perl though.

    It also illustrates one of the major differences between Python and Perl. In Python "tuple-ness" comes from the comma operator. In Perl "list-ness" comes from the list context of the expression. If you come to one language from the other it can be confusing either way. Python folk stare at the right hand side of the expression when they should be looking at the left in Perl. Perl folk stare at the left side and wonder where their @ symbols have gone :-)

    Except in a few specific cases, named functions are preferred to lambdas.

    True. But is that because named functions are better, or because the implementation of lambda sucks? The expression/statement distinction that applies to lambda and not named functions seems complicated and evil to me.

    Even if true removing anonymous functions just because they're not often appropriate doesn't seem like a good decision to me, and can lead to some pointless redundant naming of functions.

    That said, I think it's fair to say that more Perl programmers will prefer Ruby to Python.

    Yeah, that seems to be true in my experience.

      Where does Ruby have this? Never noticed it myself (which may be more of a comment on my observational skills ;-)
      It's minor (if you format your code properly... blah blah blah), but see here and here

      But is that because named functions are better, or because the implementation of lambda sucks?
      Oh, both ;-)

        It's minor (if you format your code properly... blah blah blah), but see here and here

        Ah. Good point. Not surprised I never came across it as a problem though :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://468939]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-03-28 18:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found