Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #6192
Show key headers only | View raw
Chris Angelico <rosuav@gmail.com> writes:
> On Wed, May 25, 2011 at 9:16 AM, John Bokma <john@castleamber.com> wrote:
>> Chris Angelico <rosuav@gmail.com> writes:
>>
>>> Yes, I believe that was Perl. And an amusing quote. But most of the
>>> point of it comes from the fact that Perl uses punctuation for most of
>>> its keywords,
>>
>> For example?
>>
>>> whereas (say) Python uses English words; it's a lot more
>>> fun to crunch something down when you can use $|
>>
>> That's not a keyword but a special (global) variable. On top of that,
>> you don't have to use it [1] and most people most likely encounter this in
>> (badly) written CGI scripts originating in the last century.
>
> Okay, poor example. But there's a lot of Perl that uses concise
> notation for things that in Python are keyworded; for instance,
> regular expressions.
Perl does have indeed operators for matching and substitution. It's:
( my $foo = $bar ) =~ s/ ... / ... /;
versus
foo = re.sub(r" ... ", " ... ", bar )
and:
my $foo = qr/
...
/xi;
versus:
foo = re.compile(r"""
...
""", re.IGNORECASE|re.VERBOSE)
It's just a matter of taste IMO. The regular expression noise stays the
same ;-).
>>> and friends than when you have to put "x and y", complete with spaces,
>>> for a simple boolean.
>>
>> Perl has also the and logical operator. This is legal Perl:
>>
>> if ( $x and $y ) {
>> print "yes\n";
>> }
>
> That's at a completely different precedence level, isn't it?
Yes, /but/ in this case it doesn't matter. Of course there are cases
that it /does/ matter:
> For instance:
>
> $a = $b && $c ? $e : $f;
> # versus
> $a = $b and $c ? $e : $f;
>
> The first one is an assignment to $a, conditional on two variables.
> The second is an unconditional assignment to $a, and then based on
> that, evaluates either $e or $f and does nothing with it.
>
> Python:
> a = e if b and c else f
Yes, "recently" added to the language, before that you had to and or
your way out of it (or use lambdas).
> It's pretty similar, actually (although, coming from a C background, I
> do prefer to have the condition first); but I could crunch the first
> one down a lot, while the last one is almost as tight as it can be.
>
> $a=$b&&$c?$e:$f;
> a=e if b and c else f
>
> It's that crunched appearance that makes Perl look like line noise,
So you just agree with what I earlier wrote: one /can/ write harder to
read in Perl, like you can jump off a cliff. And I have seen a lot of
extremely badly written Perl code, but never seen a disaster like the
one above ;-).
> and the open keyworded appearance that makes Python look like
> pseudocode. But that's not necessarily a good thing; a courteous
> programmer can space out Perl to keep it readable, and he then has the
> option of crunching pieces that are 'logically one' and spacing out
> the parts that aren't:
>
> $a= $b&&$c ? $e : $f;
>
> Silly, contrived example, but in production code I've often had
> situations where it makes sense to space out one part of an expression
> and crunch another. And when everything's an English word, that's not
> an available option.
I would write it like
$a = ( $b and $c ) ? $e : $f;
> That said, though, I do find Python a lot easier for reading other
> people's code in. A LOT easier.
Like I wrote earlier: I find Perl easier to read. And honestly, I don't
know why. Partially it might have a lot to do with having been exposed
to it much more. But many years back, when I could pick between several
languages, Perl was the one that stuck with me. And that was before
everybody and his mom was hacking CGI scripts in Perl (badly).
And while I do want to switch to Python (or use it more often), for one
reason or another it's hard. Maybe it's for similar reasons that one
loves Spanish but hates German as a second language (or vice versa)?
Both Perl and Python are evolving. Perl has a lot of bagage from the
beginning, and more so since a lot got slapped on later on. Things are
changing, but you just can't make major changes since people, like me I
guess, are used to how things are right now.
I now and then have peeks at Perl 6 and each time my first reaction is:
this is Perl only in name; it's very, very different. On the other hand
it still shares what I consider warts with Perl 5.
--
John Bokma j3b
Blog: http://johnbokma.com/ Perl Consultancy: http://castleamber.com/
Perl for books: http://johnbokma.com/perl/help-in-exchange-for-books.html
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Why did Quora choose Python for its development? Beliavsky <beliavsky@aol.com> - 2011-05-20 09:39 -0700
Re: Why did Quora choose Python for its development? Dotan Cohen <dotancohen@gmail.com> - 2011-05-20 23:47 +0300
Re: Why did Quora choose Python for its development? Chris Angelico <rosuav@gmail.com> - 2011-05-22 15:01 +1000
Re: Why did Quora choose Python for its development? "Octavian Rasnita" <orasnita@gmail.com> - 2011-05-22 10:44 +0300
Re: Why did Quora choose Python for its development? Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2011-05-23 12:56 +0200
Re: Why did Quora choose Python for its development? Duncan Booth <duncan.booth@invalid.invalid> - 2011-05-23 11:28 +0000
Re: Why did Quora choose Python for its development? "Octavian Rasnita" <orasnita@gmail.com> - 2011-05-24 08:25 +0300
Re: Why did Quora choose Python for its development? Kevin Walzer <kw@codebykevin.com> - 2011-05-24 10:09 -0400
Re: Why did Quora choose Python for its development? Chris Angelico <rosuav@gmail.com> - 2011-05-25 00:43 +1000
Re: Why did Quora choose Python for its development? "Octavian Rasnita" <orasnita@gmail.com> - 2011-05-24 19:11 +0300
Re: Why did Quora choose Python for its development? Daniel Kluev <dan.kluev@gmail.com> - 2011-05-22 19:20 +1100
Re: Why did Quora choose Python for its development? "Octavian Rasnita" <orasnita@gmail.com> - 2011-05-22 15:47 +0300
Re: Why did Quora choose Python for its development? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-05-22 12:09 -0700
Re: Why did Quora choose Python for its development? Terry Reedy <tjreedy@udel.edu> - 2011-05-22 18:01 -0400
Re: Why did Quora choose Python for its development? John Bokma <john@castleamber.com> - 2011-05-22 18:55 -0500
Re: Why did Quora choose Python for its development? Daniel Kluev <dan.kluev@gmail.com> - 2011-05-23 10:42 +1100
Re: Why did Quora choose Python for its development? "Octavian Rasnita" <orasnita@gmail.com> - 2011-05-23 08:31 +0300
Re: Why did Quora choose Python for its development? "Octavian Rasnita" <orasnita@gmail.com> - 2011-05-23 09:06 +0300
Re: Why did Quora choose Python for its development? Chris Angelico <rosuav@gmail.com> - 2011-05-23 16:37 +1000
Re: Why did Quora choose Python for its development? John Bokma <john@castleamber.com> - 2011-05-23 10:26 -0500
Re: Why did Quora choose Python for its development? Terry Reedy <tjreedy@udel.edu> - 2011-05-23 02:37 -0400
Re: Why did Quora choose Python for its development? Daniel Kluev <dan.kluev@gmail.com> - 2011-05-23 19:05 +1100
Re: Why did Quora choose Python for its development? Aleksandar Radulovic <alex@a13x.net> - 2011-05-23 08:52 +0000
Re: Why did Quora choose Python for its development? "Octavian Rasnita" <orasnita@gmail.com> - 2011-05-23 11:49 +0300
Re: Why did Quora choose Python for its development? "Octavian Rasnita" <orasnita@gmail.com> - 2011-05-23 12:01 +0300
Re: Why did Quora choose Python for its development? "Octavian Rasnita" <orasnita@gmail.com> - 2011-05-23 12:41 +0300
Re: Why did Quora choose Python for its development? Daniel Kluev <dan.kluev@gmail.com> - 2011-05-23 20:58 +1100
Re: Why did Quora choose Python for its development? Daniel Kluev <dan.kluev@gmail.com> - 2011-05-23 21:16 +1100
Re: Why did Quora choose Python for its development? "Octavian Rasnita" <orasnita@gmail.com> - 2011-05-23 14:17 +0300
Re: Why did Quora choose Python for its development? Daniel Kluev <dan.kluev@gmail.com> - 2011-05-23 22:32 +1100
Re: Why did Quora choose Python for its development? Terry Reedy <tjreedy@udel.edu> - 2011-05-23 13:08 -0400
Re: Why did Quora choose Python for its development? "Octavian Rasnita" <orasnita@gmail.com> - 2011-05-23 22:05 +0300
Re: Why did Quora choose Python for its development? "Octavian Rasnita" <orasnita@gmail.com> - 2011-05-23 14:10 +0300
Re: Why did Quora choose Python for its development? John Bokma <john@castleamber.com> - 2011-05-24 00:17 -0500
Re: Why did Quora choose Python for its development? "D'Arcy J.M. Cain" <darcy@druid.net> - 2011-05-24 06:09 -0400
Re: Why did Quora choose Python for its development? John Bokma <john@castleamber.com> - 2011-05-24 11:52 -0500
Re: Why did Quora choose Python for its development? "D'Arcy J.M. Cain" <darcy@druid.net> - 2011-05-24 13:39 -0400
Re: Why did Quora choose Python for its development? John Bokma <john@castleamber.com> - 2011-05-24 13:17 -0500
Re: Why did Quora choose Python for its development? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-27 15:48 +1200
Re: Why did Quora choose Python for its development? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-05-26 23:53 -0700
Re: Why did Quora choose Python for its development? Roy Smith <roy@panix.com> - 2011-05-27 09:47 -0400
Re: Why did Quora choose Python for its development? Karim <karim.liateni@free.fr> - 2011-05-27 22:10 +0200
Re: Why did Quora choose Python for its development? "thegist@nospam.net" <thegist@nospam.net> - 2011-05-25 17:30 -0400
Re: Why did Quora choose Python for its development? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-25 23:52 +0000
Re: Why did Quora choose Python for its development? "thegist@nospam.net" <thegist@nospam.net> - 2011-05-26 11:05 -0400
Re: Why did Quora choose Python for its development? Chris Angelico <rosuav@gmail.com> - 2011-05-25 08:01 +1000
Re: Why did Quora choose Python for its development? John Bokma <john@castleamber.com> - 2011-05-24 18:16 -0500
Re: Why did Quora choose Python for its development? Chris Angelico <rosuav@gmail.com> - 2011-05-25 09:38 +1000
Re: Why did Quora choose Python for its development? John Bokma <john@castleamber.com> - 2011-05-24 20:48 -0500
Re: Why did Quora choose Python for its development? Thorsten Kampe <thorsten@thorstenkampe.de> - 2011-05-25 09:31 +0200
Re: Why did Quora choose Python for its development? John Bokma <john@castleamber.com> - 2011-05-25 07:01 -0500
Re: Why did Quora choose Python for its development? Terry Reedy <tjreedy@udel.edu> - 2011-05-25 12:54 -0400
Re: Why did Quora choose Python for its development? Ethan Furman <ethan@stoneleaf.us> - 2011-05-25 10:17 -0700
Re: Why did Quora choose Python for its development? John Bokma <john@castleamber.com> - 2011-05-25 14:14 -0500
Re: Why did Quora choose Python for its development? Matty Sarro <msarro@gmail.com> - 2011-05-25 17:19 -0400
Re: Why did Quora choose Python for its development? Neil Cerutti <neilc@norwich.edu> - 2011-05-26 12:44 +0000
Re: Why did Quora choose Python for its development? Roy Smith <roy@panix.com> - 2011-05-26 08:51 -0400
Re: Why did Quora choose Python for its development? Ben Finney <ben+python@benfinney.id.au> - 2011-05-26 23:11 +1000
Re: Why did Quora choose Python for its development? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-26 13:35 +0000
Re: Why did Quora choose Python for its development? RainyDay <andrei.avk@gmail.com> - 2011-05-25 17:15 -0700
Re: Why did Quora choose Python for its development? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-25 23:01 +0000
Re: Why did Quora choose Python for its development? John Bokma <john@castleamber.com> - 2011-05-25 22:00 -0500
Re: Why did Quora choose Python for its development? Ben Finney <ben@benfinney.id.au> - 2011-05-26 14:25 +1000
Re: Why did Quora choose Python for its development? John Bokma <john@castleamber.com> - 2011-05-26 10:36 -0500
Re: Why did Quora choose Python for its development? Terry Reedy <tjreedy@udel.edu> - 2011-05-26 16:03 -0400
Re: Why did Quora choose Python for its development? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-27 03:07 +0000
Re: Why did Quora choose Python for its development? Thorsten Kampe <thorsten@thorstenkampe.de> - 2011-05-27 10:10 +0200
Re: Why did Quora choose Python for its development? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-27 09:31 +0000
Re: Why did Quora choose Python for its development? Ethan Furman <ethan@stoneleaf.us> - 2011-05-27 10:12 -0700
Re: Why did Quora choose Python for its development? Karim <karim.liateni@free.fr> - 2011-05-26 22:27 +0200
Re: Why did Quora choose Python for its development? Ethan Furman <ethan@stoneleaf.us> - 2011-05-26 09:18 -0700
Re: Why did Quora choose Python for its development? Thorsten Kampe <thorsten@thorstenkampe.de> - 2011-05-26 10:24 +0200
Re: Why did Quora choose Python for its development? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-25 23:25 +0000
Re: Why did Quora choose Python for its development? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-05-24 23:00 -0700
Re: Why did Quora choose Python for its development? Roy Smith <roy@panix.com> - 2011-05-25 07:36 -0400
Re: Why did Quora choose Python for its development? Chris Angelico <rosuav@gmail.com> - 2011-05-25 21:55 +1000
Re: Why did Quora choose Python for its development? Roy Smith <roy@panix.com> - 2011-05-25 08:25 -0400
Re: Why did Quora choose Python for its development? "D'Arcy J.M. Cain" <darcy@druid.net> - 2011-05-25 10:23 -0400
Re: Why did Quora choose Python for its development? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-25 14:56 +0000
Re: Why did Quora choose Python for its development? Matty Sarro <msarro@gmail.com> - 2011-05-25 11:43 -0400
Re: Why did Quora choose Python for its development? Chris Angelico <rosuav@gmail.com> - 2011-05-26 00:26 +1000
Re: Why did Quora choose Python for its development? "Octavian Rasnita" <orasnita@gmail.com> - 2011-05-24 19:10 +0300
Re: Why did Quora choose Python for its development? "D'Arcy J.M. Cain" <darcy@druid.net> - 2011-05-24 13:22 -0400
Re: Why did Quora choose Python for its development? "Octavian Rasnita" <orasnita@gmail.com> - 2011-05-24 11:08 +0300
Re: Why did Quora choose Python for its development? Daniel Kluev <dan.kluev@gmail.com> - 2011-05-24 14:34 +1100
Re: Why did Quora choose Python for its development? "Octavian Rasnita" <orasnita@gmail.com> - 2011-05-24 08:39 +0300
Re: Why did Quora choose Python for its development? "Octavian Rasnita" <orasnita@gmail.com> - 2011-05-24 09:00 +0300
Re: Why did Quora choose Python for its development? Stefan Behnel <stefan_ml@behnel.de> - 2011-05-24 08:23 +0200
Re: Why did Quora choose Python for its development? Kevin Walzer <kw@codebykevin.com> - 2011-05-24 10:50 -0400
Re: Why did Quora choose Python for its development? "Octavian Rasnita" <orasnita@gmail.com> - 2011-05-24 19:18 +0300
Re: Why did Quora choose Python for its development? "Octavian Rasnita" <orasnita@gmail.com> - 2011-05-24 11:10 +0300
Re: Why did Quora choose Python for its development? Chris Angelico <rosuav@gmail.com> - 2011-05-24 18:20 +1000
Re: Why did Quora choose Python for its development? Daniel Kluev <dan.kluev@gmail.com> - 2011-05-24 19:55 +1100
Re: Why did Quora choose Python for its development? "D'Arcy J.M. Cain" <darcy@druid.net> - 2011-05-24 06:05 -0400
Re: Why did Quora choose Python for its development? Teemu Likonen <tlikonen@iki.fi> - 2011-05-24 16:18 +0300
Re: Why did Quora choose Python for its development? John Bokma <john@castleamber.com> - 2011-05-24 11:50 -0500
Re: Why did Quora choose Python for its development? Chris Angelico <rosuav@gmail.com> - 2011-05-25 03:30 +1000
Re: Why did Quora choose Python for its development? John Bokma <john@castleamber.com> - 2011-05-24 12:56 -0500
Re: Why did Quora choose Python for its development? Chris Angelico <rosuav@gmail.com> - 2011-05-25 07:53 +1000
Re: Why did Quora choose Python for its development? John Bokma <john@castleamber.com> - 2011-05-24 17:00 -0500
Re: Why did Quora choose Python for its development? "Octavian Rasnita" <orasnita@gmail.com> - 2011-05-24 19:10 +0300
Re: Why did Quora choose Python for its development? "Octavian Rasnita" <orasnita@gmail.com> - 2011-05-24 19:10 +0300
Re: Why did Quora choose Python for its development? "thegist@nospam.net" <thegist@nospam.net> - 2011-05-26 11:52 -0400
Re: Why did Quora choose Python for its development? Daniel Kluev <dan.kluev@gmail.com> - 2011-05-27 08:33 +1100
Re: Why did Quora choose Python for its development? RainyDay <andrei.avk@gmail.com> - 2011-05-26 16:41 -0700
csiph-web