On 5/22/2011 3:44 AM, Octavian Rasnita wrote:

I've noticed that on many Perl mailing lists the list members talk
very rarely about Python,

Interesting. I learned about Python on comp.lang.perl, but that was over a decade ago.

but only on this Python mailing list I read
many discussions about Perl, in which most of the participants use to
agree that yes, Python is better, as it shouldn't be obvious that
most of the list members prefer Python.

This list really has very little other-language bashing.

A few months ago I have asked how can I create a dictionary from a
list, and there were so many techniques that I think that it is just
a buzzword that in Perl there are many ways to do it, while in Python
there is a single way. In Python I found from the messages I received
on this mailing list that there are a lot of ways, without even
beeing a "recommended" way, while in Perl there is a single way, of
course much shorter and clearer.

I forget the exact question you asked, but this list is not the doc. The doc section on dicts gives dict(list_of_key_value_pairs) as the one true way, given such an input. The Perl way cannot be clearer and can only be shorted if it uses something shorter that dict().

If the list is a flat list of alternating keys and values, then yes, they must be paired, and there are several ways to do that, partly depending on the exact specifications, including allowed input and how an odd key left over should be treated. In any case, unpaired keys and values strikes me as an unusual input format for a dict. They typically would have been paired as some point and in Python, should not need to be unpaired.

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to