Why did Quora choose Python for its development?

Octavian Rasnita orasnita at gmail.com
Mon May 23 05:01:35 EDT 2011


From: "Chris Angelico" <rosuav at gmail.com>
> On Mon, May 23, 2011 at 3:31 PM, Octavian Rasnita <orasnita at gmail.com> 
> wrote:
>> From: "Dennis Lee Bieber" <wlfraed at ix.netcom.com>
>>>
>>> Since indentation seems so crucial to easy comprehension of the logical
>>> structure of a program,
>>> making it a mandatory syntactical structure becomes a desirable feature
>>> for code that must be maintained (by others, in many cases).
>>
>> Why "in many cases"? I wrote hundreads of programs which are working fine
>> and which are maintained only by me. (But they would be very easy to
>> maintain by other people if it would be necessary).
>> So in that case, why to be forced to use a strict indentation?
>
> The reason for clear code is maintenance, not maintenance-by-others.
> If you come back to something in a year, you'll appreciate proper
> variable names, indentation, etc.
>
> That said, though, I still do not believe in Python's philosophy of
> significant whitespace. I like to be able, if I choose, to put one
> entire "logical unit" on one line, such that it can be commented out
> with a single comment marker, or duplicated to another line and one
> copy commented out, or whatever. To that end, I sometimes want to put
> an if, its associated else, and sometimes a statement for both
> branches, all in the one line. And that's not possible when whitespace
> alone defines the end of an if/else block (the one-line form of a
> Python 'if' can't have a non-conditional statement after it at all),
> but is quite easy when things are delimited with braces.


Yes I also agree with that, and I also prefer *in some cases* to write short 
code in a single line like:

print "..." if $var;

print $var == 123 ? "abcd" : "cedf";

print $var =~ /foo/ ? "abc" : "cdef";

...instead of writing a few lines of code. These constructs are not 
recommended for Perl either, and Perl::Critic would give a warning when it 
will be used with a certain level of errors checking, but it is preferable 
to be able to do what you want how you or your team want, not as the creator 
of the programming language wants.

And I don't think that there are programmers that find the lines above hard 
to understand or maintain.

Octavian




More information about the Python-list mailing list