New to Python: Features

Alex Martelli aleaxit at yahoo.com
Tue Oct 5 04:59:04 EDT 2004


Dan Bishop <danb_83 at yahoo.com> wrote:
   ...
> Most of your questions are answered at http://docs.python.org/

Yep, but some of the answers are debatable.  E.g.:

> > 3. Function nesting with proper lexical scope (i.e. closures)
> 
> Yes.

...but no rebinding in outer-scope, which to some people (not functional
programmers, obviously;-) means it ain't "proper".


> > 4. Operator overloading (inc. the ability to define new operators)
> 
> Yes.  This is done by defining the special methods __add__, __mul__,

...which doesn't let you define NEW operators, just the code that runs
when known operators are applied to objects of a certain user-coded
type.  To define new operators, look instead for example to Haskell.
(I've never seen "operator overloading" used to describe "define new
operators", they're really totally distinct language features).


Alex



More information about the Python-list mailing list