Confused with Functions and decorators

Jerry lu nicholascannon1 at gmail.com
Sat Jul 19 06:52:18 EDT 2014


Ok so i am trying to learn this and i do not understand some of it. I also tried to searched the web but i couldnt find any answers. 

1. I dont understand when i will need to use a function that returns another function.
eg
                   def outer():
                         def inner():
                               x = 5 
                          return inner
    
     why not just use inner and forget about the whole outer function?

2. This is more yes or no question when you pass in a func into another func as a parameter do you need to specify the parameter that the func is being passed into as func? 
eg   
                      def passinto(func)
                            pass
            
                       def param():
                             x = 5
                   
                        p = passinto(param)

also is this above statement correct?????
     



More information about the Python-list mailing list