On Aug 8, 8:25 am, Peter Otten <[EMAIL PROTECTED]> wrote: > kj7ny wrote: > > What is @checkPrivs (see example copied below from other post)? In > > fact... how does the thing work at all? > > @checkPrivs > > def add(a,b): > > return a+b > > @... is called a decorator and is just a fancy way of writing > > def add(a, b): > return a+b > add = checkPrivs(add) > > Peter
Is this cheating? class a: def square(self, x): print 'executing:', dir(self)[-1] print x*x def cube(self, x): print 'executing:', dir(self)[-2] print x*x*x b=a() b.square(3) b.cube(3) Output: PyMate r6780 running Python 2.3.5 (python) >>> function self naming2.py executing: square 9 executing: cube 27 -- http://mail.python.org/mailman/listinfo/python-list