which feature of python do you like most?

Mike Meyer mwm at mired.org
Tue Nov 8 16:02:25 EST 2005


"James" <james.hague at gmail.com> writes:

> Most of the responses are of the "Why Python is more pleasant than C++"
> variety, but the original poster specifically said he had experience
> with Perl.  As such, arguments like "automatic memory management" don't
> carry any weight.
>
>>From my experience as both a Perl and Python user--and I do prefer Perl
> for many tasks--the big win for Python is when you have complex data
> structures: dictionaries containing arrays, arrays of arrays, array of
> dictionaries, and so on.  This kind of thing is awkward in Perl (you
> need to use references), but perfectly natural and obvious in Python.

Further, when operators use those structures, all they really care
about is the API. You can create your own classes with those APIs, and
plug them in (almost) anywhere the the builtin types are used. The
APIs and how to create them is well-documented, and the distribution
ships with example of several of the types.

Making a user class work anywhere you can put a mapping in Perl is
deep magic, but easy in Python. Creating types that act like files and
can be used wherever a file is used is SOP in Python; I'm not even
sure it's possible in Perl (probably is, but it's again deep magic).

     <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list