alias method definitions / syntactic sugar suggestion

Aahz aahz at
Wed Mar 18 20:41:34 CET 2009

In article <mailman.1321.1236340190.11746.python-list at>,
andrew cooke <andrew at> wrote:
>Terry Reedy wrote:
>> @alias('justAsFantastic')
>> def someFantasticMethod(args): ...
>does this exist?  i read the previous post and thought "i think a
>decorator could do that", but i haven't written one.
>the reason i ask is that for 3->2 backwards compatability i need to do
>this in a couple of places.  it would be nice to have:
>  @alias('__nonzero__')
>  def __bool__(self):
>and even better(?) if it could depend on python version!

How about using a class decorator?
Aahz (aahz at           <*>

"Programming language design is not a rational science. Most reasoning
about it is at best rationalization of gut feelings, and at worst plain
wrong."  --GvR, python-ideas, 2009-3-1

More information about the Python-list mailing list