Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'wed,': 0.03; 'instance,': 0.05; 'operator': 0.05; 'python:': 0.05; 'subject:Python': 0.06; 'python': 0.08; 'conditional': 0.09; 'expressions.': 0.09; 'oh,': 0.09; 'precedence': 0.09; 'variables.': 0.09; 'scripts': 0.10; 'programmer': 0.11; '25,': 0.12; 'written': 0.14; 'am,': 0.14; 'received:209.85.214.174': 0.14; 'received:mail- iw0-f174.google.com': 0.14; 'wrote:': 0.14; '(eg': 0.16; 'angelico': 0.16; 'background,': 0.16; 'contrived': 0.16; 'encounter': 0.16; 'evaluates': 0.16; 'example?': 0.16; 'fluent': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'instance:': 0.16; 'okay,': 0.16; 'operator.': 0.16; 'perl.': 0.16; 'precedence"': 0.16; 'quote.': 0.16; 'syntactic': 0.16; 'up:': 0.16; 'variable.': 0.16; 'versus': 0.16; 'worse.': 0.16; '\xa0print': 0.16; 'english.': 0.19; 'keyword': 0.19; 'level,': 0.19; "people's": 0.19; 'perl': 0.19; 'writes:': 0.19; 'header:In- Reply-To:1': 0.21; 'concise': 0.23; 'example.': 0.23; 'pieces': 0.23; 'referring': 0.23; 'similar,': 0.23; '(or': 0.24; 'code': 0.24; 'expect': 0.25; 'mainly': 0.26; "i'm": 0.27; 'message- id:@mail.gmail.com': 0.28; 'received:209.85.214': 0.28; 'be.': 0.29; 'subject:?': 0.29; 'elements': 0.29; 'opposed': 0.29; 'bit': 0.30; 'second': 0.30; 'fact': 0.30; 'easier.': 0.30; 'keywords,': 0.30; 'lot,': 0.30; 'sort': 0.31; 'it.': 0.31; 'expression': 0.32; 'does': 0.33; 'to:addr:python-list': 0.33; 'generally': 0.33; 'actually': 0.33; "isn't": 0.33; 'it?': 0.33; 'things': 0.33; "i've": 0.33; 'rather': 0.34; 'regular': 0.34; 'chris': 0.34; '[1]': 0.34; 'that,': 0.34; 'example,': 0.35; 'option': 0.35; 'assignment': 0.35; 'option.': 0.35; 'else': 0.35; 'open': 0.36; 'uses': 0.36; 'received:google.com': 0.37; 'issue': 0.37; 'something': 0.37; 'received:209.85': 0.37; 'keywords': 0.37; 'pretty': 0.37; 'put': 0.37; 'two': 0.37; 'could': 0.38; 'url:org': 0.38; 'but': 0.38; 'word,': 0.38; 'subject:: ': 0.38; 'easier': 0.39; 'received:209': 0.39; 'either': 0.39; 'to:addr:python.org': 0.39; 'everyone': 0.40; 'almost': 0.60; 'more': 0.60; 'john': 0.62; 'friends': 0.64; 'believe': 0.66; 'skip:$ 10': 0.66; 'special': 0.66; 'production': 0.68; 'legal': 0.70; 'crunch': 0.84; 'noise,': 0.84; 'notion': 0.84; 'subject:Why': 0.84; 'subject:choose': 0.84; 'subject:its': 0.84; "everything's": 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=RRwnWePJ54npemFyzET+lf73Ti55yCaUPkzGTR08D5U=; b=dnLInTCUJfkJW70d4egMBPzDULEBJW+rUZWLcHzULkWsJucTyraKLFmMOztdqfxPYA QYcal9lZagvDsyam/X9HUnc404WSUdWvbzpzKVWCqXOPot1NswjKPqUqCrhewG1WPRBd uxCmnUavp3jtH9Hy6yx2vWb5aY5bhRsnfXY/c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=kouHKQML/IZh7XkHfjt/maKdrkRSQ1BisGqhjCf9tCdsqfancJmSE7ymTuMDvtD3Lc tC3ClzAWl9IVtpAsEREIfQpWHUUQFyxiNwkBTEuhIkwaCQivt7ynuBJJbRKIweJK/PfE eqWoD0dfJi9qoB1cgCYelngYOKevsNBv04xxw= MIME-Version: 1.0 In-Reply-To: <87mxibsn9l.fsf@castleamber.com> References: <80d59383-36a3-4744-85c4-1a0577f1d3a6@dr5g2000vbb.googlegroups.com> <9CDC4B2CD1F445E994119A50F65155DF@teddy> <12225671E9654FECB49613D915FAEC19@teddy> <21A740B7AC6644248476DFADDF726C73@octavian> <629DAC3611EA49B0A36BCF70151CDE2F@octavian> <87sjs44qyk.fsf@castleamber.com> <87zkmcujl4.fsf@castleamber.com> <20110524133902.b5ad22b1.darcy@druid.net> <87mxibsn9l.fsf@castleamber.com> Date: Wed, 25 May 2011 09:38:08 +1000 Subject: Re: Why did Quora choose Python for its development? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 82 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1306280290 news.xs4all.nl 49047 [::ffff:82.94.164.166]:55283 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:6184 On Wed, May 25, 2011 at 9:16 AM, John Bokma wrote: > Chris Angelico 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 i= n > (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 ) { > =A0print "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 " operator precedence" in Google?) brought up: http://perldoc.perl.org/perlop.html For instance: $a =3D $b && $c ? $e : $f; # versus $a =3D $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 =3D 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=3D$b&&$c?$e:$f; a=3De 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=3D $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