Robert Fendt wrote: > And thus spake John Bokma <j...@castleamber.com> > Tue, 30 Mar 2010 13:19:19 -0600: > >> And >> >> a == b and 'Yes' or 'No' >> >> isn't a Perl-ism? > > I never said that this would be better. I don't even get the > point of what the advantage is supposed to be of inverting the > order of the return statement and the conditional check what > should actually _be_ returned. What's wrong with just writing > > if a==b: > return 'Yes' > else: > return 'No' > > apart from it being a few more line breaks and an additional > return statement? The inverted form is not more readable per > se (in fact, quite the opposite), and I would even suggest to > minimise its use even in languages like C++ and Java. The Python > syntax is even worse since it not only inverts the order of > return statement and conditional check, but it also puts the > conditional between the two results. > > I find such a convoluted construct especially ugly in a language > which I previously regarded as having a rather striking beauty > of syntactical simplicity. The construct is superfluous, > illogical, unelegant, and thus very un-pythonesque, IMHO. But of > course that's just my $0.02. > >> Sheesh, this group would be so much nicer without the constant dragging >> in of Perl to make a point. On top of that, do { } unless blocks are >> not idomatic in Perl. Perl Best Practices even clearly states to *never* >> use unless. > > Sorry, but you have just underlined my point, in fact. If it's > discouraged by experts, then of course the question must be > valid why such a feature even exists (okay, apart from 'it > seemed like a good idea at the time'). And more importantly (and > more on-topic here), why we have to have an analogon in Python.
It exists because people nagged Guido mercilessly until, against his better judgment, he capitulated. regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 See PyCon Talks from Atlanta 2010 http://pycon.blip.tv/ Holden Web LLC http://www.holdenweb.com/ UPCOMING EVENTS: http://holdenweb.eventbrite.com/ -- http://mail.python.org/mailman/listinfo/python-list