andrew cooke wrote:
[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.

Not that I know of -- an exercise for the reader.

Now that I think about it more, injecting a name into what will become the class dict is not trivial. I assume that one of the 'get the caller's namespace' tricks would work, but have not tried it.

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)

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to