
On Sat, 6 Aug 2011 01:19:58 -0700 Chris Rebert <pyideas@rebertia.com> wrote:
On Sat, Aug 6, 2011 at 1:16 AM, Chris Rebert <pyideas@rebertia.com> wrote:
On Sat, Aug 6, 2011 at 1:10 AM, David Townshend <aquavitae69@gmail.com> wrote:
Has anyone else ever thought that it might be useful to access a function object from within the call?
Yes:
And also: [Rejected] PEP 3130: Access to Current Module/Class/Function http://www.python.org/dev/peps/pep-3130/
The new magic super() uses a similar, hidden, compiler-activated hack to work properly:
class C: ... def f(): super ... C.f.__closure__ (<cell at 0x7fe2bb402e98: type object at 0x14ec5e0>,) C.f.__closure__[0].cell_contents <class '__main__.C'>
sup = super class D: ... def f(): sup ... D.f.__closure__
Regards Antoine.