Why did Quora choose Python for its development?

Octavian Rasnita orasnita at gmail.com
Mon May 23 05:41:56 EDT 2011


From: "Daniel Kluev" <dan.kluev at gmail.com>

> On Mon, May 23, 2011 at 5:06 PM, Octavian Rasnita <orasnita at gmail.com> 
> wrote:
>> There are more, but a single eloquent feature is the possibility of
>> interpreting variables in strings which cannot be done so nice in Python.
>
> I've should probably mentioned it earlier, but I'm not Perl expert,
> not following its development and can't be bothered to read its docs.
> Could you please provide examples of features you mention with
> expected result, so I could suggest reasonable Python analogue?

The ones that bash other languages on the mailing list for their prefered 
language should provide good comparisons and not just make false statements, 
considering that it is enough, since most of the list members will agree 
because they like Python more than other languages anyway.

If they think that what they say is true, why don't they make those 
statements on Perl mailing lists, but again, offering valid comparisons.

> But if you want to couple it with controller code, there, as I said,
> are numerous ways to do it. You can even do something like this:
>
> class SomeController(BaseController):
>    ...
>    @map(conditions=dict(method='GET'))
>    def some_method(self, arg1:int, arg2:str):
>         ...
> so it would be called via /somecontroller/some-method/1/blabla with
> trivial decorator.


Is the url something like /some_controller/some_method? Or the underlines 
are deleted from the name of the controller and replaced with "-" in the 
name of the method?
Is it possible to also add a configuration here to call this some_method 
when the url /some_controller/some-method-string is accessed?
(define another string than the name of the method)
Is it possible to configure it to access this subroutine only if a certain 
number of parameters are sent in the URL?

If yes, it means that its dispatcher is better than I've seen in the short 
tutorial on the web.

>> (unless in Pylons/Pyramid can be also defined chained mappings and 
>> mappings
>> based on regular expressions).
>
> Not sure what do you mean by "based on regular expressions". Routes
> paths ARE regular expressions. Conditions are regexes too.
>
> As for chained mappings - no idea, never had the need in such thing.

The chained dispatcher is one of the best thing offered by Catalyst, because 
with it the same code should not be used twice.

For example, one can define a subroutine in which a certain record is 
selected from the DB and is placed in stash.
Then there may be other subroutines for different tasks, one for editing 
that record, one for deleting that record and so on.
One chain can start with the base subroutine that makes the selection from 
the DB then executes the subroutine that makes the deletion and another 
chain can start with the base subroutine that makes the selection than 
continues with the one that starts the editting.
Of course, the chain can have more links, not only 2, but this was just a 
very short example.

>> I've checked the documentation for some of them and I've seen that most 
>> of
>> them don't support sub-selects and some of them require using plain SQL 
>> code
>> in their construct for more complex queries.
>> Please tell me which of them supports sub-selects, and are able to return
>> objects for date and datetime fields that have methods for beeing able to
>> print just the year or day, or the months names in the specified locale
>> because it would be useful.
>
> Python has builtin type for DateTime, and SQLAlchemy, for example,
> returns exactly that:
>>>> t1.date.month
> 5

Can it also set the current locale, for example romanian, and print the name 
of the current month?
...something like t1.date.set_locale('ro').month_name?

> SELECT anon_1.test_id AS anon_1_test_id, anon_1.test_val AS
> anon_1_test_val, anon_1.test_date AS anon_1_test_date
> FROM (SELECT test.id AS test_id, test.val AS test_val, test.date AS 
> test_date
> FROM test) AS anon_1

As I said, that ORM is not able to do those SQL constructs without using 
literal SQL code, but only Python variables and data structures...
An ORM is usually prefered exactly because it doesn't force the programmer 
to concatenate strings for generating the SQL code, but he/she can use just 
standard Perl/Python code.
Or this is possible in another way without using SQL code?

>> it can do but DBIx::Class cannot, because otherwise it would be very 
>> simple
>> for anyone to just say "go to read the documentation and see how great it
>> is".
>
> But "go to read the docs" argument works both ways - I have zero
> knowledge of DBIx::Class, so obviously I cannot say what features it
> lacks compared to SQLA.

Yes you are perfectly right, but not those programmers that also use Perl 
started to say that Perl can do this and Python can't, or that in Perl this 
is shorter and nicer than in Python.
I just wanted to show that anything Python can do can be done in Perl also, 
and in some fields Python is better, in other fields Perl is better, and we 
should use whatever we like the most, and not say bad words about other 
languages or about those who use other languages, especially in a 
coward-way, on the group of programmers that prefer the praised language.

Octavian





More information about the Python-list mailing list