Why did Quora choose Python for its development?

Octavian Rasnita orasnita at gmail.com
Tue May 24 02:00:14 EDT 2011


From: "Daniel Kluev" <dan.kluev at gmail.com>
> Moreover, you are comparing apples to oranges here, and then
> complaining that apples somehow turned out to be not oranges.
> If we take python way of defining dicts and check it in perl, we find
> that it is not supported, so obviously perl is non-intuitive and does
> not support clear and easy way of defining hashes from list of
> key-value pairs:
> @l = ([1, 2], [3, 4],);
> %d = @l;
> for $k ( keys %d ) { print "$k\n"; }
>
> which outputs single ARRAY(0x804e158) instead of proper 1, 3, as it
> does in python:
>
>>>> dict([[1,2], [3,4]]).keys()
> [1, 3]
>
> This is yet another example that you are just trolling here, making
> silly and unbacked claims, and ignoring any valid arguments you
> receive.


You are showing a code but tell another thing. If it would be as you said, I 
should have said that if in Perl a dictionary is made from a list using
%d = @l;

then in Python it should be
l = d

because it would be more nice. But I didn't say that. I said that it would 
be nice to be able to use something like
d = dict(l)

using the Python "dict" statement for creating dicts.

And OK, Python needs another pair of brackets for doing that and this is no 
problem, but the result is that the Python's syntax is not as shorter and 
nice as Perl's, for the same thing.
This is what that I said.

And you are telling that in Perl should be used an even more complicated and 
ugly syntax just for beeing the same as in Python just for showing that I am 
wrong, but I was comparing just the shortness and cleraness of the code.

So, again, in Perl is just:

%d = @l;

Please tell me if Python has a syntax which is more clear than this for 
doing this thing.
It doesn't matter if it is different or if it follows another syntax.

And again, I am not trolling anything. I am just defending a language which 
has a clearer syntax for doing some things, and a shorter code for other 
things, and which uses less braces and brackets than Python for other 
things, and which has a single-recommended way for doing some things, even 
though other list members were trolling about Perl, but nobody said 
something against.

Octavian




More information about the Python-list mailing list