Re: decorators tutorials

2009-03-23 Thread Scott David Daniels
Josiah Carlson wrote: ... I try to limit my use of decorators whenever possible, both because I still have to support Python 2.3 (which doesn't support the syntax), and because I find that they obfuscate what the code is doing more often than not. I will admit that they are useful as a metapro

Re: decorators tutorials

2007-07-25 Thread Josiah Carlson
james_027 wrote: > hi bruno, > > That seems to be hard to read at all, or I am just very new to python? No, it's hard to read. Note that it's not, technically, necessary to use nested functions to get the same results as a particular decorator. For example, earlier you provided... def check

Re: decorators tutorials

2007-07-23 Thread Jason
On Jul 23, 11:25 am, Jason <[EMAIL PROTECTED]> wrote: > On Jul 23, 2:13 am, james_027 <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I am learning python by learning django, and I stumble upon decorator > > which is very cool, any beginners resources for python decorators, > > although I can google it,

Re: decorators tutorials

2007-07-23 Thread Steve Holden
james_027 wrote: > Hi, > >>> def check_login(func): >>> def _check_login(*args): >>> print "I am decorator" >>> return func(*args) >>> return _check_login >>> @check_login >>> def method2(input): >>> print "I am method TWO. Input %s" % input >> That looks okay. What is

Re: decorators tutorials

2007-07-23 Thread Jason
On Jul 23, 2:13 am, james_027 <[EMAIL PROTECTED]> wrote: > Hi, > > I am learning python by learning django, and I stumble upon decorator > which is very cool, any beginners resources for python decorators, > although I can google it, I just want to get a good tutorial for this > topic. > > Thanks >

Re: decorators tutorials

2007-07-23 Thread Bruno Desthuilliers
james_027 a écrit : > hi bruno, > > That seems to be hard to read at all, or I am just very new to python? or just new to higher order functions ? (ie: functions working on functions). > With that decorator how do I take advantage of it compare when I just > write a function that could do the s

Re: decorators tutorials

2007-07-23 Thread Diez B. Roggisch
james_027 wrote: > hi bruno, > > That seems to be hard to read at all, or I am just very new to python? > > With that decorator how do I take advantage of it compare when I just > write a function that could do the same as what the decorator did? I > could translate the could from above into ...

Re: decorators tutorials

2007-07-23 Thread james_027
Hi, > > def check_login(func): > > def _check_login(*args): > > print "I am decorator" > > return func(*args) > > return _check_login > > > @check_login > > def method2(input): > > print "I am method TWO. Input %s" % input > > That looks okay. What is unclear? > It jus

Re: decorators tutorials

2007-07-23 Thread Ben Finney
james_027 <[EMAIL PROTECTED]> writes: > Hi all, (Please don't top-post your reply. Instead, remove from the quoted material all the parts that are irrelevant to your reply, and post underneath what you're responding to, in normal chronological order like any other discussion.) > I am having diff

Re: decorators tutorials

2007-07-23 Thread james_027
hi bruno, That seems to be hard to read at all, or I am just very new to python? With that decorator how do I take advantage of it compare when I just write a function that could do the same as what the decorator did? I could translate the could from above into ... def check_login(msg): #...

Re: decorators tutorials

2007-07-23 Thread james_027
Hi all, I am having difficulty understanding decorator. The definition was clear for me, but the syntax is not so clear to me. will decorators will always have to be in this way def check_login(func): def _check_login(*args): print "I am decorator" return func(*args) retu

Re: decorators tutorials

2007-07-23 Thread Bruno Desthuilliers
james_027 a écrit : > Hi all, > > I am having difficulty understanding decorator. The definition was > clear for me, but the syntax is not so clear to me. > > will decorators will always have to be in this way > > def check_login(func): > def _check_login(*args): > print "I am decora

Re: decorators tutorials

2007-07-23 Thread Roel Schroeven
james_027 schreef: > Hi, > > I am learning python by learning django, and I stumble upon decorator > which is very cool, any beginners resources for python decorators, > although I can google it, I just want to get a good tutorial for this > topic. I like the short explanation on Kent's Korner:

Re: decorators tutorials

2007-07-23 Thread [EMAIL PROTECTED]
james_027 wrote: > Hi, > > I am learning python by learning django, and I stumble upon decorator > which is very cool, any beginners resources for python decorators, > although I can google it, I just want to get a good tutorial for this > topic. Decorators are just a more concise but less obvious

Re: decorators tutorials

2007-07-23 Thread Michele Simionato
On Jul 23, 10:13 am, james_027 <[EMAIL PROTECTED]> wrote: > Hi, > > I am learning python by learning django, and I stumble upon decorator > which is very cool, any beginners resources for python decorators, > although I can google it, I just want to get a good tutorial for this > topic. > > Thanks

Re: decorators tutorials

2007-07-23 Thread Bruno Desthuilliers
james_027 a écrit : > Hi, > > I am learning python by learning django, and I stumble upon decorator > which is very cool, any beginners resources for python decorators, > although I can google it, I just want to get a good tutorial for this > topic. You should find answers on python.org, and sear

decorators tutorials

2007-07-23 Thread james_027
Hi, I am learning python by learning django, and I stumble upon decorator which is very cool, any beginners resources for python decorators, although I can google it, I just want to get a good tutorial for this topic. Thanks james -- http://mail.python.org/mailman/listinfo/python-list