Re: Confusion about decorators

2011-12-12 Thread Henrik Faber
On 12.12.2011 15:01, Arnaud Delobelle wrote: >> I am very amazed -- I've been programming Python for about 5 years now >> and have never even come close to something as a "descriptor protocol". >> Python never ceases to amaze me. Do you have any beginners guide how >> this works? The Pydoc ("Data

Re: Confusion about decorators

2011-12-12 Thread Arnaud Delobelle
On 12 December 2011 13:52, Henrik Faber wrote: > On 12.12.2011 14:45, Arnaud Delobelle wrote: > >>> Can someone please enlighten me? >> >> You can (need to?) use the descriptor protocol to deal with methods. >> >> from functools import partial > [...] >>        def __get__(self, obj, objtype): >>

Re: Confusion about decorators

2011-12-12 Thread Henrik Faber
On 12.12.2011 14:45, Arnaud Delobelle wrote: >> Can someone please enlighten me? > > You can (need to?) use the descriptor protocol to deal with methods. > > from functools import partial [...] >def __get__(self, obj, objtype): >return partial(self, obj) Whoa. This is abs

Re: Confusion about decorators

2011-12-12 Thread Henrik Faber
On 12.12.2011 14:37, Andrea Crotti wrote: > On 12/12/2011 01:27 PM, Henrik Faber wrote: >> Hi group, >> >> I'm a bit confused regarding decorators. Recently started playing with >> them with Python3 and wanted (as an excercise) to implement a simple >> type checker first: I know there are lots of t

Re: Confusion about decorators

2011-12-12 Thread Arnaud Delobelle
On 12 December 2011 13:27, Henrik Faber wrote: > Hi group, > > I'm a bit confused regarding decorators. Recently started playing with > them with Python3 and wanted (as an excercise) to implement a simple > type checker first: I know there are lots of them out there, this is > actually one of the

Re: Confusion about decorators

2011-12-12 Thread Andrea Crotti
On 12/12/2011 01:27 PM, Henrik Faber wrote: Hi group, I'm a bit confused regarding decorators. Recently started playing with them with Python3 and wanted (as an excercise) to implement a simple type checker first: I know there are lots of them out there, this is actually one of the reasons I cho