Why did Quora choose Python for its development?

R

RainyDay

Ethan Furman said:
Terry said:
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.

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?
 
J

John Bokma

Steven D'Aprano said:
if Python is really so much better than Python [Perl]
readability wise, why do I have such a hard time dropping
Perl and moving on?

My guess is that you have an adversarial view of computer languages,

Well, it's clear that you are indeed the fuckwit I suspected you
are. What's a pity is that you are so vocal in this group and to me at
least makes it a way less pleasant experience to read this group.

Get a life. Or better, just **** off and die. It will improve both the
world and the Python community, of which you are nothing but a little,
smelly shitstain.
 
T

Thorsten Kampe

* John Bokma (Wed, 25 May 2011 07:01:07 -0500)
Thorsten Kampe said:
* Chris Angelico (Wed, 25 May 2011 08:01:38 +1000)
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.

You've made that "alphabet" argument more than once. Nevertheless it's
nonsense (sorry). Perl uses the same alphabet as Python. Only the
"words" Perl uses ("$|" for instance) are only found in a Perl
dictionary not in a English or math dictionary like the one that Python
uses.

That's why you can /read/ Python but you have to /decode/ Perl to
understand the source code.
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?

What kind of argument is that?

Thorsten
 
N

Neil Cerutti

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.
 
R

Roy Smith

Neil Cerutti said:
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.
 
S

Steven D'Aprano

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
 
T

thegist

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.
 
J

John Bokma

Ben Finney said:
That abuse is entirely unwelcome in this community, against any person.
Please desist.

You should have spoken up sooner, especially as the spokes person of
"this" community. But every bully has is fan club.
 
T

thegist

So when quora.com fails we can all say it is Python's fault?
Maybe they should have focused more on content instead of
the bits under the hood?
 
E

Ethan Furman

John,

You say English is not your first language. Let me assure you that the
words you chose to use in reply to Stephen were vulgar as well as rude,
and did more to lesson the overall friendliness of this forum than
Stephen's adversarial style.

You usually have interesting and informative posts -- please don't
resort to this tactic.

~Ethan~
 
D

Daniel Kluev

This is a forced example to fit the way Python can do it with a clean syntax, but I don't think there are cases in which somebody wants to create hashes/dictionaries where the key is not a plain string but an array.

This is not a rare case, but a case that probably nobody needs, ever.

This is far more popular case than converting flat lists into dicts in
Python world. In fact, I *never* had need to convert flat list instead
of properly structured one. Thats why we have both lists and tuples,
after all.
Sure, since perl does not support it at all, perl programmers do not
use it and resort to idea of "guess which values are keys by index"
due to lack of better approach, with need of obscure "=>"
pseudo-syntax to cover it up.
 
R

RainyDay

This is far more popular case than converting flat lists into dicts in
Python world. In fact, I *never* had need to convert flat list instead
of properly structured one. Thats why we have both lists and tuples,
after all.

I agree that it's almost never needed to convert flat
lists. I've used python for over 10 years and I remember
exactly one time when I needed to do that. It turned out
that it's a bit tricky and hacky to do in python, in
the sense that it's hard to remember if I'll ever need
it again, but it will only take minutes to google it.

For example, in one piece of code I did recently I
created a dict of range tuples and counts from a sequential list, like
so:

ranges = [(x*width, (x+1)*width) for x in range(y)]
data = dict((x,0) for x in ranges)

A perl programmer would instead create a flat list
and then convert it to dict. And if he were new to
python he'd create a flat list and then be annoyed
that there's no quick and easy way to make it into
a dict.

Python way in this case is more structured and
disciplined, and the only "flaw" I can see is that
it doesn't meet expectations of perl programmers.

-Rainy
 
S

Steven D'Aprano

[impolite comment not quoted]
Get a life. Or better, just **** off and die. It will improve both
the world and the Python community, of which you are nothing but a
little, smelly shitstain.

That abuse is entirely unwelcome in this community, against any
person. Please desist.

You should have spoken up sooner, especially as the spokes person of
"this" community. But every bully has is fan club.

I agree that the original impolite comment was just that -- impolite --
and perhaps enough so that it should have been spoken out against.

Okay, I've stayed silent while people criticize me long enough. What
exactly did I say that was impolite?

Is this one of those things where it is "impolite" to say certain things
in public even though in private everyone knows they are true?

We all know that some people have adversarial views of all sorts of
things, including computer languages. "My language of choice is better
than your language of choice". Most of us can probably name examples, or
if not, it wouldn't take much effort on Google to find them.

If we're honest to ourselves, we'd realise that we're all at least a
*little bit* adversarial. XKCD's famous cartoon about "People are WRONG
on the Internet!" is funny because we can so often relate to it. We
really do think some languages are better than others, in objective ways
as well as subjective, and want to "support our language". That's partly
why we're here, to give back to the language that we enjoy using. We're
just more nuanced about our opinion than the trolls.

And we also know that people keep going back to their language of choice
for all sorts of reasons that aren't objective. Why do I keep going back
to Pascal instead of C? I'll give you all sorts of objective reasons why
I think Pascal is a better designed language, but the real reason is
because it makes me comfortable. It was the first language I learned.

Objectively, I should just drop it and move on, but I'm going to keep
tilting at those windmills hoping to turn the tide of popular opinion and
see a mass migration of C coders to Pascal...

*cough*

John threw down a distinct challenge:

if Python is really so much better than Python [sic]
readability wise, why do I have such a hard time dropping
Perl and moving on?

Am I really the only one who can hear the "oh yeah smart guy" at the
start of that sentence?

If this is one of those lines you're not allowed to cross, where
everybody knows that people invest self-image in their job or choice of
language ("dammit, I'm a *Python coder*, I'd never stoop to writing
COBOL!" sort of thing) but you mustn't mention it because that would be
impolite, well, screw that for a game of soldiers. Sometimes politeness
is the grease that keeps society's wheels turning, and sometimes it's
just blinkers that stops us from understanding ourselves and others.

If I got it wrong about John, oh well, I said it was a guess, and trying
to get inside someone else's head is always a chancy business. But the
fact that he responded so aggressively instead of saying "Ha, Freudian
projection, much?" hints that maybe I hit a button. Or maybe I just ran
into him on a bad day.

Projection? Yes, I cheerfully admit it. *My* self-image is partly "I am a
Python coder", not an enterprise Java suit or a VB code monkey. It's more
complicated than that, of course, but let's remember also that the Perl
community is *full* of people who self-identify as "Just Another Perl
Hacker".

John, I'd apologise if I thought I said something rude or nasty to you,
but I don't, so I don't believe I have anything to apologise for. But I
will say that I regret that you took it as an attack, and assure you that
it was not meant that way.
 
G

Gregory Ewing

John said:
A Perl programmer will call this line noise:

double_word_re = re.compile(r"\b(?P<word>\w+)\s+(?P=word)(?!\w)",
re.IGNORECASE)
for match in double_word_re.finditer(text):
print ("{0} is duplicated".format(match.group("word"))

Actually, Python programmers would tend to call the RE part
of that line noise, too.

It's for that reason that we tend to avoid using REs when
possible, reaching for them only as a tool of last resort.
 
D

Dennis Lee Bieber

It's for that reason that we tend to avoid using REs when
possible, reaching for them only as a tool of last resort.

I STILL haven't reached for them... For my purposes, a 50 line
procedure is more legible and easier to modify.

Uh... Well... Let me modify that -- I think I have few in Forte
Agent's filters...
 
T

Thorsten Kampe

* Steven D'Aprano (27 May 2011 03:07:30 GMT)
Okay, I've stayed silent while people criticize me long enough. What
exactly did I say that was impolite?
Nothing.

John threw down a distinct challenge:

if Python is really so much better than Python [sic]
readability wise, why do I have such a hard time dropping
Perl and moving on?
[...]
If I got it wrong about John, oh well, I said it was a guess, and
trying to get inside someone else's head is always a chancy business.

Why were you trying to speculate in response to such a - sorry - dumb[1]
question? What do his personal failures to switch to Python (why did he
even try?) have to do with whether a) Python is more readable than Perl
and b) whether readability counts towards productivity?

/Maybe/ it is simply because he "somehow like Perl more" but
definitely that is not really relevant to the question about
readibility.
Or maybe I just ran into him on a bad day.

"Bad argument day". His other "Python vs Perl is like Latin vs
Devanagari" argument is not really better. The problem with Perl is that
it does /not/ use (Latin) alphabetic characters (like a, b, c) to form
words but symbols ($, %, @. |, *) and re-combines them to give them new
and special meaning.

So this is exactly /not/ a alphabet vs alphabet thing but a word(s) vs
symbols.

Thorsten
[1] Sorry for being impolite. But "why do I...?" kind of rhetorical
questions (as arguments) are just dumb.
 
S

Steven D'Aprano

* Steven D'Aprano (27 May 2011 03:07:30 GMT) [...]
If I got it wrong about John, oh well, I said it was a guess, and
trying to get inside someone else's head is always a chancy business.

Why were you trying to speculate in response to such a - sorry - dumb[1]
question?

Because someone was WRONG on the INTERNET!!!

*wink*
 
R

Roy Smith

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".
 
E

Ethan Furman

Thorsten said:
* Steven D'Aprano (27 May 2011 03:07:30 GMT)
Okay, I've stayed silent while people criticize me long enough. What
exactly did I say that was impolite?
Nothing.

John threw down a distinct challenge:

if Python is really so much better than Python [sic]
readability wise, why do I have such a hard time dropping
Perl and moving on?
[...]
If I got it wrong about John, oh well, I said it was a guess, and
trying to get inside someone else's head is always a chancy business.

Why were you trying to speculate in response to such a - sorry - dumb[1]
question?

He asked the question not once, but multiple times (IIRC at least three,
possible more) -- after a while it stops being rhetorical.

I would say also, if you don't want an answer, don't ask the question.

~Ethan~
 
K

Karim

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top