Confused with Functions and decorators

Jerry lu nicholascannon1 at
Sun Jul 20 04:24:41 CEST 2014

ok I seem to very confused about this. Is there like a page or web page that like completely sums this up so i can study. I am going to look up 'functions in python'. I am not sure if this is what we a talking about as a whole here but I'am sure that I'll find something. I am all good with decorators just I can't wrap my head around why we need a function within a function? like the outer and inner thing. for example if we have like:

>>> def multi_squared(func):
               def multi():
                     return (func)**2
               return math
>>>@math #does decorator go here or when we call the function???
>>>def number(x, y):
             return x*y

is this above example valid? like this is the stuff i am stuck on like i know what todo or i think i know but not sure if it is perfectly valid. I am going to search for something now but if you know where i could find something like this or if you could sort it out that would be great.

More information about the Python-list mailing list