Jerry wrote:
> Thanks to everyone that resonded. I will have to spend some time
> reading the information that you've provided.
>
> To Fredrik, unfortunately yes. I saw the examples, but couldn't get my
> head wrapped around their purpose.
You're probably looking at the newfangled @decorator syn
Fredrik Lundh wrote:
> Jerry wrote:
>
> > even though I've read the PEP
>
> even the examples section?
>
> http://www.python.org/dev/peps/pep-0318/#examples
>
The second example of which shows :
Define a class with a singleton instance. Note that once the class
disappears enterprising progr
Jerry a écrit :
> Thanks to everyone that resonded. I will have to spend some time
> reading the information that you've provided.
>
> To Fredrik, unfortunately yes. I saw the examples, but couldn't get my
> head wrapped around their purpose. Perhaps it's due to the fact that
> my only experien
Thanks to everyone that resonded. I will have to spend some time
reading the information that you've provided.
To Fredrik, unfortunately yes. I saw the examples, but couldn't get my
head wrapped around their purpose. Perhaps it's due to the fact that
my only experience with programming is PHP,
At Friday 20/10/2006 02:38, [EMAIL PROTECTED] wrote:
it's handy for doing things like validation of parameter and return
types. Like...
@accepts(int,int)
@returns(int)
def add(a,b):
return a+b
So, it's handy for converting Python into another language :)
--
Gabriel Genellina
Softlab SRL
Jerry wrote:
> even though I've read the PEP
even the examples section?
http://www.python.org/dev/peps/pep-0318/#examples
if you want more examples, see the cookbook
http://www.google.com/search?q=+site%3Aaspn.activestate.com+decorator+cookbook
--
http://mail.python.org/mailman/listin
[EMAIL PROTECTED] wrote:
> it's handy for doing things like validation of parameter and return
> types. Like...
>
> @accepts(int,int)
> @returns(int)
> def add(a,b):
> return a+b
using Python decorators to turn Python into something that's not Python
doesn't seem very handy to me, though.
it's handy for doing things like validation of parameter and return
types. Like...
@accepts(int,int)
@returns(int)
def add(a,b):
return a+b
On Oct 19, 2:04 pm, "Jerry" <[EMAIL PROTECTED]> wrote:
> I have just started to do some semi-serious programming (not one-off
> specialized scripts) and
When you want to repeatedly apply a certain ALGORITHM to arbitrary sets
of DATA, you write a FUNCTION.
When you want to add a certain BEHAVIOR to arbitrary sets of FUNCTIONS,
you write a DECORATOR.
An excellent use of decorators is in Django, the web programming
framework. Django keeps track of
At Thursday 19/10/2006 15:04, Jerry wrote:
Now I've
come accross decorators and even though I've read the PEP and a little
in the documentation, I just don't get what they are or what problem
they are trying to solve. Can anyone please point me to a general
discussion of decorators (preferrably
I have just started to do some semi-serious programming (not one-off
specialized scripts) and am loving Python. I just seem to get most of
the concepts, the structure, and the classes (something I struggled
with before in other languages). I've seen many concepts on the web
(i.e. stacks, queues,
11 matches
Mail list logo