[Israel.pm] A bit about Python
aronovitch at gmail.com
Tue Nov 17 02:35:23 PST 2009
On Tue, Nov 17, 2009 at 10:26 AM, Jason Elbaum <jason.elbaum at gmail.com> wrote:
>> they (the python world) hate mini-languages, and prefer objects with a
>> lot of methods.
Adding to previous answer about sprintf and the % operator:
BTW: string.ljust is a flat function, not a method (though there's
also an .ljust() method for strings).
> Python is to Perl as Java is to C++.
As much as I hate the comparison (Java is just too annoying for my
taste), have to partly agree.
> Like C++, Perl is a multiparadigm language; features a complex legacy
> syntax which is difficult to parse; prefers to empower the programmer
> at the risk of sometimes fragile and even dangerous constructs; and is
> designed to support systems-level tasks (at different levels of the
> system, but still).
> Like Java, Python is a single-paradigm language in which everything is
> an object with a class; features a relatively clean syntax designed in
> part for good tool support;
Differ on that. Everything is an object just means configurability
(you can inherit and modify most types, and even that is rather new)
certainly not single-paradigm. E.g. : though OO is widely used,
procedural programming (functions) is also very powerful in Python and
much more flexible than in e.g. C++ (you pass functions around freely
and passing any callable with the right interface would work fine -
power of dynamic languages :-)). Using functions instead of class
methods is actually encouraged when appropriate ("flat is better than
Single-syntax does not necessarily mean single paradigm.
> prefers to restrict the programmer's
> freedom in the name of safety and clarity; and doesn't mind if you use
> a different language for writing device drivers or system
> administration scripts.
Don't think perl minds it either...
More information about the Perl