Ticket #288 (new enhancement)
method aliasing via assignment
| Reported by: | rmurri | Owned by: | somebody |
|---|---|---|---|
| Priority: | minor | Milestone: | wishlist |
| Component: | Code Generation | Keywords: | |
| Cc: |
Description (last modified by scoder) (diff)
It would be nice to have method aliasing via assignment, i.e.
def foo(): # do something bar = foo
As of Cython 0.11.1, this works with "def" and "cpdef" methods, but fails for "cdef" ones::
def foo():
print "foo"
bar = foo
cdef foo2():
print "foo2"
bar2 = foo2 # fails with error:: Cannot convert 'object (void)' to Python object
cdef class A(object):
def foo(self):
print "A.foo"
bar = foo
cdef foo2(self):
print "A.foo2"
bar2 = foo2 # fails with error:: Cannot convert 'object (A)' to Python object
cpdef foo3(self):
print "A.foo3"
bar3 = foo3
bar()
bar2()
a = A()
a.foo()
a.foo2()
a.foo3()
It also fails for some instances of Python's "__special__" methods, see e.g. http://codespeak.net/pipermail/cython-dev/2009-April/004898.html
Change History
Note: See
TracTickets for help on using
tickets.
