Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #5859 > unrolled thread
| Started by | Beliavsky <beliavsky@aol.com> |
|---|---|
| First post | 2011-05-20 09:39 -0700 |
| Last post | 2011-05-26 16:41 -0700 |
| Articles | 20 on this page of 105 — 27 participants |
Back to article view | Back to comp.lang.python
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
Page 3 of 6 — ← Prev page 1 2 [3] 4 5 6 Next page →
| From | Roy Smith <roy@panix.com> |
|---|---|
| Date | 2011-05-27 09:47 -0400 |
| Message-ID | <roy-4FA234.09472127052011@news.panix.com> |
| In reply to | #6367 |
In article <948l8nF33pU1@mid.individual.net>,
Gregory Ewing <greg.ewing@canterbury.ac.nz> wrote:
> John Bokma wrote:
>
> > A Perl programmer will call this line noise:
> >
> > double_word_re = re.compile(r"\b(?P<word>\w+)\s+(?P=word)(?!\w)",
> > re.IGNORECASE)
One of the truly awesome things about the Python re library is that it
lets you write complex regexes like this:
pattern = r"""\b # beginning of line
(?P<word>\w+) # a word
\s+ # some whitespace
(?P=word)(?!\w) # the same word again
"""
double_word_re = re.compile(pattern, re.I | re.X)
Sometimes regex really is the best tool. It's often the most compact,
or fastest, or clearest way to express something complicated.
Fortunately, re.X mode gives you a way to write truly monster regexes
and still having them not be total line noise.
It's a shame that the Python community has evolved to be so anti-regex
that most people never consider using them. While Perl's attitude to
regex may be "when the only tool you have is a hammer, everything looks
like a nail", Python's seems to be, "I've got a great collection of all
kinds of neat tools, so I'm going to pretend the hammer that's in there
doesn't exist because I once smashed my thumb with it and it hurt a lot".
[toc] | [prev] | [next] | [standalone]
| From | Karim <karim.liateni@free.fr> |
|---|---|
| Date | 2011-05-27 22:10 +0200 |
| Message-ID | <mailman.2172.1306527043.9059.python-list@python.org> |
| In reply to | #6388 |
On 05/27/2011 03:47 PM, Roy Smith wrote: > In article<948l8nF33pU1@mid.individual.net>, > Gregory Ewing<greg.ewing@canterbury.ac.nz> wrote: > >> John Bokma wrote: >> >>> A Perl programmer will call this line noise: >>> >>> double_word_re = re.compile(r"\b(?P<word>\w+)\s+(?P=word)(?!\w)", >>> re.IGNORECASE) > One of the truly awesome things about the Python re library is that it > lets you write complex regexes like this: > > pattern = r"""\b # beginning of line > (?P<word>\w+) # a word > \s+ # some whitespace > (?P=word)(?!\w) # the same word again > """ > double_word_re = re.compile(pattern, re.I | re.X) > > Sometimes regex really is the best tool. It's often the most compact, > or fastest, or clearest way to express something complicated. > Fortunately, re.X mode gives you a way to write truly monster regexes > and still having them not be total line noise. > > It's a shame that the Python community has evolved to be so anti-regex > that most people never consider using them. While Perl's attitude to > regex may be "when the only tool you have is a hammer, everything looks > like a nail", Python's seems to be, "I've got a great collection of all > kinds of neat tools, so I'm going to pretend the hammer that's in there > doesn't exist because I once smashed my thumb with it and it hurt a lot". HAHAHAHAHAHA Very funny! This thread is awsome. Cheers Karim
[toc] | [prev] | [next] | [standalone]
| From | "thegist@nospam.net" <thegist@nospam.net> |
|---|---|
| Date | 2011-05-25 17:30 -0400 |
| Message-ID | <72183$4ddd7506$ce534406$5707@news.eurofeeds.com> |
| In reply to | #6163 |
On 5/24/2011 1:39 PM, D'Arcy J.M. Cain wrote: [snip] > One of my favorite quotes (not sure if it was about Perl or APL) is "I > refuse to use a programming language where the proponents of it stick > snippets under each other's nose and say 'I bet you can't guess what > this does.'" I dunno. That sounds about like how most programming course exams are written, no? The point is that puzzling through arcane bits of code are crucial to learning any language. It's a valuable exercise.
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2011-05-25 23:52 +0000 |
| Message-ID | <4ddd963c$0$29996$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #6266 |
On Wed, 25 May 2011 17:30:48 -0400, thegist@nospam.net wrote: > On 5/24/2011 1:39 PM, D'Arcy J.M. Cain wrote: [snip] >> One of my favorite quotes (not sure if it was about Perl or APL) is "I >> refuse to use a programming language where the proponents of it stick >> snippets under each other's nose and say 'I bet you can't guess what >> this does.'" > I dunno. That sounds about like how most programming course exams are > written, no? > The point is that puzzling through arcane bits of code are crucial to > learning > any language. It's a valuable exercise. You seem to miss the point that a good language shouldn't make it possible to write arcane code that needs to be puzzled out. Although in fairness, what's arcane to me might be straightforward to you... and vice versa. In that sense, there probably aren't any "good languages", because it is impractical to have a language that cannot be obfuscated in any way. Nevertheless, we can distinguish "less good" from "more good" in languages in the sense of readability. The fact that some languages not just allow such obfuscation but encourage it makes the language great for puzzles but not so good for when you actually want to get work done and have to deal with code written by someone else. *Especially* if they're significantly smarter, or dumber, than you. Worst of all is dealing with code written by somebody who *thinks* they're smarter but is actually dumber. -- Steven
[toc] | [prev] | [next] | [standalone]
| From | "thegist@nospam.net" <thegist@nospam.net> |
|---|---|
| Date | 2011-05-26 11:05 -0400 |
| Message-ID | <1ec5d$4dde6c53$ce534406$30768@news.eurofeeds.com> |
| In reply to | #6279 |
On 5/25/2011 7:52 PM, Steven D'Aprano wrote: > On Wed, 25 May 2011 17:30:48 -0400, thegist@nospam.net wrote: > >> On 5/24/2011 1:39 PM, D'Arcy J.M. Cain wrote: [snip] >>> One of my favorite quotes (not sure if it was about Perl or APL) is "I >>> refuse to use a programming language where the proponents of it stick >>> snippets under each other's nose and say 'I bet you can't guess what >>> this does.'" >> I dunno. That sounds about like how most programming course exams are >> written, no? >> The point is that puzzling through arcane bits of code are crucial to >> learning >> any language. It's a valuable exercise. > > You seem to miss the point that a good language shouldn't make it > possible to write arcane code that needs to be puzzled out. You seem to be inventing a new point. Try to stay focused please. Perl hackers show each other arcane bits of code because such impractical puzzle programs are good for learning. Such puzzles can be created in any language. For example, I have had formal coursework in a number of languages (Pascal, C++, ML, Scheme, and others) and in each one an important exercise was to puzzle through arcane bits of code in each of those languages. The post I was replying to seemed to question the value of such 'I bet you can't guess what this does.' type challenges.
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2011-05-25 08:01 +1000 |
| Message-ID | <mailman.2041.1306274502.9059.python-list@python.org> |
| In reply to | #6159 |
On Wed, May 25, 2011 at 3:39 AM, D'Arcy J.M. Cain <darcy@druid.net> wrote:
> My point was that even proponents of the language can make a
> significant error based on the way the variable is named. It's like
> the old Fortran IV that I first learned where the name of the variable
> determined whether it was an integer or a floating point.
I believe that's the origin of one of the proofs that God is real
(unless declared integer). And hey, I can't hate something that gave
us the classic use of i, j, k as loop indices!
> One of my favorite quotes (not sure if it was about Perl or APL) is "I
> refuse to use a programming language where the proponents of it stick
> snippets under each other's nose and say 'I bet you can't guess what
> this does.'"
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, whereas (say) Python uses English words; it's a lot more
fun to crunch something down when you can use $| and friends than when
you have to put "x and y", complete with spaces, for a simple boolean.
But that says nothing about which language is actually better for
working with... beyond the fact that Perl can get more mileage out of
an 80-character line!
> When I first looked at Perl it looked like line noise. When I first
> looked at Python it looked like pseudo-code.
When I first looked at assembly language it looked like random junk
left behind in memory. When I first looked at COBOL it looked like ...
COBOL. Doesn't make either of them better or worse.
Pseudo-code is not a viable language for a computer to parse, but it's
a good language for scribbling down comments in. That doesn't
necessarily mean that a programming language that's "closer to"
pseudo-code is good. And verbosity doesn't necessarily equate to
quality; for instance, when I'm working in both Python and PHP, I find
it FAR tidier to use Python's {1:2,3:4] notation than PHP's
array(1=>2,3=>4) - but on the flip side, I would prefer to have
program structure defined by keywords like "if" and "while" than
obscure random line noise. (Fortunately, most sane languages do indeed
use keywords there.)
Chris Angelico
[toc] | [prev] | [next] | [standalone]
| From | John Bokma <john@castleamber.com> |
|---|---|
| Date | 2011-05-24 18:16 -0500 |
| Message-ID | <87mxibsn9l.fsf@castleamber.com> |
| In reply to | #6178 |
Chris Angelico <rosuav@gmail.com> writes:
> On Wed, May 25, 2011 at 3:39 AM, D'Arcy J.M. Cain <darcy@druid.net> wrote:
>> My point was that even proponents of the language can make a
>> significant error based on the way the variable is named. It's like
>> the old Fortran IV that I first learned where the name of the variable
>> determined whether it was an integer or a floating point.
>
> I believe that's the origin of one of the proofs that God is real
> (unless declared integer). And hey, I can't hate something that gave
> us the classic use of i, j, k as loop indices!
>
>> One of my favorite quotes (not sure if it was about Perl or APL) is "I
>> refuse to use a programming language where the proponents of it stick
>> snippets under each other's nose and say 'I bet you can't guess what
>> this does.'"
>
> 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.
Yes, Perl is fantastic for writing hard to read obfuscated code. And
yes, newbies are great at writing this from the very start, especially
since they seem to copy paste examples written by other newbies (often
written in the previous century...). But Perl doesn't force one to write
unreadable code. If Perl was really so unreadable, why haven't I /still/
not switched to Python? What keeps me going back to Perl?
> 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";
}
[1] You can use $OUTPUT_AUTOFLUSH (use English;), or use IO::Handle and
use the autoflush method [2].
[2] In Perl 5.14 IO::File is now loaded on demand:
http://search.cpan.org/dist/perl/pod/perldelta.pod#Filehandle_method_calls_load_IO::File_on_demand
--
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
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2011-05-25 09:38 +1000 |
| Message-ID | <mailman.2046.1306280290.9059.python-list@python.org> |
| In reply to | #6183 |
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. I'm insufficiently fluent in Perl to quote good
examples; mainly what I'm referring to is the notion of operators that
are separators, as opposed to keywords that get blank-delimited. I
generally prefer syntactic elements to be punctuation (eg { } rather
than BEGIN and END (or DO and END)). It does also make things easier
to crunch, for better or for worse.
>> 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? For
operators up where you expect them to be, there's && and ||. A bit of
digging (why isn't this sort of thing always the first hit for "<name
of language> operator precedence" in Google?) brought up:
http://perldoc.perl.org/perlop.html
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
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,
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.
Oh, and that's ignoring the issue that not everyone is fluent in English.
That said, though, I do find Python a lot easier for reading other
people's code in. A LOT easier.
Chris Angelico
[toc] | [prev] | [next] | [standalone]
| From | John Bokma <john@castleamber.com> |
|---|---|
| Date | 2011-05-24 20:48 -0500 |
| Message-ID | <87ipszsg7l.fsf@castleamber.com> |
| In reply to | #6184 |
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
[toc] | [prev] | [next] | [standalone]
| From | Thorsten Kampe <thorsten@thorstenkampe.de> |
|---|---|
| Date | 2011-05-25 09:31 +0200 |
| Message-ID | <MPG.2846cebd5418b032989810@news.individual.de> |
| In reply to | #6178 |
* Chris Angelico (Wed, 25 May 2011 08:01:38 +1000) > > On Wed, May 25, 2011 at 3:39 AM, D'Arcy J.M. Cain <darcy@druid.net> wrote: > > One of my favorite quotes (not sure if it was about Perl or APL) is "I > > refuse to use a programming language where the proponents of it stick > > snippets under each other's nose and say 'I bet you can't guess what > > this does.'" > > 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, whereas (say) Python uses English words; it's a lot more > fun to crunch something down when you can use $| and friends than when > you have to put "x and y", complete with spaces, for a simple boolean. > But that says nothing about which language is actually better for > working with... [...] It does say something about readibility. And yes, "readability counts". And yes, readability says a lot about how good a language is for reading and working with. Thorsten
[toc] | [prev] | [next] | [standalone]
| From | John Bokma <john@castleamber.com> |
|---|---|
| Date | 2011-05-25 07:01 -0500 |
| Message-ID | <87vcwzyoos.fsf@castleamber.com> |
| In reply to | #6201 |
Thorsten Kampe <thorsten@thorstenkampe.de> writes: > * Chris Angelico (Wed, 25 May 2011 08:01:38 +1000) >> >> On Wed, May 25, 2011 at 3:39 AM, D'Arcy J.M. Cain <darcy@druid.net> wrote: >> > One of my favorite quotes (not sure if it was about Perl or APL) is > "I >> > refuse to use a programming language where the proponents of it stick >> > snippets under each other's nose and say 'I bet you can't guess what >> > this does.'" >> >> 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, whereas (say) Python uses English words; it's a lot more >> fun to crunch something down when you can use $| and friends than when >> you have to put "x and y", complete with spaces, for a simple boolean. >> But that says nothing about which language is actually better for >> working with... [...] > > It does say something about readibility. And yes, "readability counts". > And yes, readability says a lot about how good a language is for reading > and working with. To people used to the latin alphabet languages using a different script are unreadable. So readability has a lot to do with what one is used to. Like I already stated before: if Python is really so much better than Python readability wise, why do I have such a hard time dropping Perl and moving on? -- 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
[toc] | [prev] | [next] | [standalone]
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2011-05-25 12:54 -0400 |
| Message-ID | <mailman.2082.1306342486.9059.python-list@python.org> |
| In reply to | #6226 |
On 5/25/2011 8:01 AM, John Bokma wrote: > to. Like I already stated before: if Python is really so much better > than Python readability wise, why do I have such a hard time dropping > Perl and moving on? [you meant 'than Perl'] You are one of the people whose brain fits Perl (or vice versa) better than most. So enjoy it. Ignore anyone who says otherwise. -- Terry Jan Reedy
[toc] | [prev] | [next] | [standalone]
| From | Ethan Furman <ethan@stoneleaf.us> |
|---|---|
| Date | 2011-05-25 10:17 -0700 |
| Message-ID | <mailman.2083.1306343082.9059.python-list@python.org> |
| In reply to | #6226 |
Terry Reedy wrote: > On 5/25/2011 8:01 AM, John Bokma wrote: > >> to. Like I already stated before: if Python is really so much better >> than Python readability wise, why do I have such a hard time dropping >> Perl and moving on? > > [you meant 'than Perl'] You are one of the people whose brain fits Perl > (or vice versa) better than most. So enjoy it. Ignore anyone who says > otherwise. +1 If everybody's brain worked the same, we wouldn't have so many different languages to choose from. ~Ethan~
[toc] | [prev] | [next] | [standalone]
| From | John Bokma <john@castleamber.com> |
|---|---|
| Date | 2011-05-25 14:14 -0500 |
| Message-ID | <87mxiasid4.fsf@castleamber.com> |
| In reply to | #6253 |
Ethan Furman <ethan@stoneleaf.us> writes: > Terry Reedy wrote: >> On 5/25/2011 8:01 AM, John Bokma wrote: >> >>> to. Like I already stated before: if Python is really so much better >>> than Python readability wise, why do I have such a hard time dropping >>> Perl and moving on? >> >> [you meant 'than Perl'] You are one of the people whose brain fits >> Perl (or vice versa) better than most. So enjoy it. Ignore anyone >> who says otherwise. > > +1 > > If everybody's brain worked the same, we wouldn't have so many > different languages to choose from. So, this means that in general language readability is not as clear cut as some seem to advertise ;-). -- 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
[toc] | [prev] | [next] | [standalone]
| From | Matty Sarro <msarro@gmail.com> |
|---|---|
| Date | 2011-05-25 17:19 -0400 |
| Message-ID | <mailman.2094.1306358400.9059.python-list@python.org> |
| In reply to | #6258 |
On Wed, May 25, 2011 at 3:14 PM, John Bokma <john@castleamber.com> wrote: > Ethan Furman <ethan@stoneleaf.us> writes: > >> Terry Reedy wrote: >>> On 5/25/2011 8:01 AM, John Bokma wrote: >>> >>>> to. Like I already stated before: if Python is really so much better >>>> than Python readability wise, why do I have such a hard time dropping >>>> Perl and moving on? >>> >>> [you meant 'than Perl'] You are one of the people whose brain fits >>> Perl (or vice versa) better than most. So enjoy it. Ignore anyone >>> who says otherwise. >> >> +1 >> >> If everybody's brain worked the same, we wouldn't have so many >> different languages to choose from. > > So, this means that in general language readability is not as clear cut > as some seem to advertise ;-). > > -- > 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 > -- > http://mail.python.org/mailman/listinfo/python-list > General readability is a farce. If it was true we would only have one section to the library. Different people enjoy reading, and can comprehend better in different ways. THat's why some people are super verbose - hell, just look at this here post! :)
[toc] | [prev] | [next] | [standalone]
| From | Neil Cerutti <neilc@norwich.edu> |
|---|---|
| Date | 2011-05-26 12:44 +0000 |
| Message-ID | <94709uF99gU5@mid.individual.net> |
| In reply to | #6264 |
On 2011-05-25, Matty Sarro <msarro@gmail.com> wrote: > General readability is a farce. If it was true we would only > have one section to the library. Different people enjoy > reading, and can comprehend better in different ways. THat's > why some people are super verbose - hell, just look at this > here post! :) Despite individual proclivities, there remain standards of readability enshrined in our dictionaries and grammar handbooks. Claiming that code readability of code is to be judged solely subjectively by each individual absolves code of the responsibility to communicate to more than just its author. -- Neil Cerutti
[toc] | [prev] | [next] | [standalone]
| From | Roy Smith <roy@panix.com> |
|---|---|
| Date | 2011-05-26 08:51 -0400 |
| Message-ID | <roy-F08119.08514826052011@news.panix.com> |
| In reply to | #6316 |
In article <94709uF99gU5@mid.individual.net>, Neil Cerutti <neilc@norwich.edu> wrote: > On 2011-05-25, Matty Sarro <msarro@gmail.com> wrote: > > General readability is a farce. If it was true we would only > > have one section to the library. Different people enjoy > > reading, and can comprehend better in different ways. THat's > > why some people are super verbose - hell, just look at this > > here post! :) > > Despite individual proclivities, there remain standards of > readability enshrined in our dictionaries and grammar handbooks. > Claiming that code readability of code is to be judged solely > subjectively by each individual absolves code of the > responsibility to communicate to more than just its author. Also, the purpose of source code is to transmit information (to both the compiler and to human readers). That is a much narrower purpose than is served by books in a library, many of which are written as entertainment. Sometimes, the real enjoyment (in literature) comes in figuring out what the author really meant.
[toc] | [prev] | [next] | [standalone]
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Date | 2011-05-26 23:11 +1000 |
| Message-ID | <874o4hbo9e.fsf@benfinney.id.au> |
| In reply to | #6317 |
Roy Smith <roy@panix.com> writes:
> Also, the purpose of source code is to transmit information (to both
> the compiler and to human readers).
And the relative importance of readability for those two purposes is
often misunderstood.
Composing source code so that the *machine* will understand it is one
thing, and can be unambiguously verified.
Composing the same source code so that its meaning will be clearly
transmitted to *other humans* is quite another matter: certainly more
difficult, and arguably far more important:
“Programs must be written for people to read, and only incidentally
for machines to execute.”
—Abelson & Sussman, _Structure and Interpretation of Computer
Programs_
> Sometimes, the real enjoyment (in literature) comes in figuring out
> what the author really meant.
Right. Unlike that kind of writing, in functional code like a computer
program, ambiguity of meaning is a curse.
Programmers, if you feel the urge to be subtle and clever and nuanced,
take up poetry or literature as a separate pursuit. In your program
source code, please be as straightforward and unambiguous and
predictable as possible.
--
\ “Very few things happen at the right time, and the rest do not |
`\ happen at all. The conscientious historian will correct these |
_o__) defects.” —Mark Twain, _A Horse's Tale_ |
Ben Finney
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2011-05-26 13:35 +0000 |
| Message-ID | <4dde570e$0$29996$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #6316 |
On Thu, 26 May 2011 12:44:47 +0000, Neil Cerutti wrote: > On 2011-05-25, Matty Sarro <msarro@gmail.com> wrote: >> General readability is a farce. If it was true we would only have one >> section to the library. Different people enjoy reading, and can >> comprehend better in different ways. THat's why some people are super >> verbose - hell, just look at this here post! :) > > Despite individual proclivities, there remain standards of readability > enshrined in our dictionaries and grammar handbooks. Claiming that code > readability of code is to be judged solely subjectively by each > individual absolves code of the responsibility to communicate to more > than just its author. Bravo! +1 Quote of the Thread -- Steven
[toc] | [prev] | [next] | [standalone]
| From | RainyDay <andrei.avk@gmail.com> |
|---|---|
| Date | 2011-05-25 17:15 -0700 |
| Message-ID | <8984a70f-449e-40a4-b962-0e93ba8c4071@m40g2000vbt.googlegroups.com> |
| In reply to | #6258 |
On May 25, 3:14 pm, John Bokma <j...@castleamber.com> wrote:
> Ethan Furman <et...@stoneleaf.us> writes:
> > Terry Reedy wrote:
> >> On 5/25/2011 8:01 AM, John Bokma wrote:
>
> >>> to. Like I already stated before: if Python is really so much better
> >>> than Python readability wise, why do I have such a hard time dropping
> >>> Perl and moving on?
>
> >> [you meant 'than Perl'] You are one of the people whose brain fits
> >> Perl (or vice versa) better than most. So enjoy it. Ignore anyone
> >> who says otherwise.
>
> > +1
>
> > If everybody's brain worked the same, we wouldn't have so many
> > different languages to choose from.
>
> So, this means that in general language readability is not as clear cut
> as some seem to advertise ;-).
>
I only know a tiny bit of Perl but I think you may
prefer it because it gives you some advantages in
short term but you have to pay more than it's
worth (arguably) in the long term. When you sit
down to write a new program, it's easier to do
than in python because it's quicker to type and,
of the proverbial "many ways", you chose the ones
that suit your taste better.
However, when you sit down to read someone else's
code, it's harder to read because you don't know
the intent of their authors. If they had different
taste for idioms or formatting style than you do,
you will chalk it up to them being bad programmers
and having bad coding or formatting style, so it's
not perceived as a perl's failing.
Python way has more of an emphasis on everyone
agreeing on some preferred, standard idioms so
that everyone can pick up each others' code
quickly.
Similarly, when we write in english, we have
conventions of, for instance, capitalizing at the
start of a sentence and having a period at the end
of it, and following rules of grammar. However, if
I'm writing notes for my own use, I might write:
similarly when we write in english we have
conventions of eg capitalizing at start of
sentence and having period at the end &
following rules of grammar but since i'm
writing for my own use maybe it's easier to
write in lower caps and use 3 spaces at the
end of sentences, since no-ones has to read
it but me?
[toc] | [prev] | [next] | [standalone]
Page 3 of 6 — ← Prev page 1 2 [3] 4 5 6 Next page →
Back to top | Article view | comp.lang.python
csiph-web