What is unique about Python?

Roy Smith roy at panix.com
Sat Dec 24 21:05:00 EST 2005


"Szabolcs Nagy" <nszabolcs at gmail.com> wrote:

> iterpreter (very useful for learning)

In my mind, this is the coolest feature of all.  Most of the time, I don't 
even bother looking stuff up in the docs; it's faster to just fire up an 
interpreter and try something.  Functions like:

> dir(obj) / vars(obj) (very useful for learning)

really work well with this (I'm trying to figure out some way to work 
"synergize" into this without sounding like some corporate marketing wonk).

> identation

Feh.  A red herring.  At best, syntactic sugar.  At worst, something for 
potential adopters to get hung up about.

> dynamic typing

Another absolute key feature, which can't be fully appreciated until you're 
staring at some 20-line long C++ template error message that you can't even 
begin to figure out.

> lightweight oo (no public/protected/private)

This one is debatable.  This is value in private data (and methods).  
Fortunately, Python does let you make things private with the 
double-underscore syntax.

> built-in types (list, dict, str have useful methods)

Python does come with a good assortment of built-in types and containers, 
but most languages these days come with pretty much the same assortment.

> iterator protocol

More than the protocol is the syntax.  Every iterator in Python looks and 
feels the same.  No flipping through pages of documentation to figure out 
how this particular class's iterator works.

> generators (yield syntax)
> list comprehension / generator expression
> keyword args
> slicing
> tuple assignment (unpacking tuple: a,b =1,2)
> return with multiple values (tuple makes it easy)
> widespread (it's easy to find a python module for any kind of task)
> extendible with low-level languages (pyrex/swig/boostpython)
> crossplatform
> free
> 
> nszabolcs



More information about the Python-list mailing list