alias method definitions / syntactic sugar suggestion

andrew cooke andrew at acooke.org
Fri Mar 6 06:49:44 EST 2009


[sorry for dup terry; prev not to list]

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!

or maybe there's another solution to the __bool__ problem above?  (there's
also next methods, can't think of anything else off the top of my head)

andrew






More information about the Python-list mailing list