mardi 12 février 2019

Identify if a function is a nested function

How can I identify whether or not a given function is:

  1. A closure function
  2. A nested function which isn't a closure
  3. Not a nested function

I know I can say len(function.__closure__) > 0 but this would only answer whether or not this is a closure. What about a non-closure nested function? And is there a better way to do this?





Aucun commentaire:

Enregistrer un commentaire