nested functions

Gordon McMillan gmcm at hypernet.com
Thu Feb 24 18:45:45 EST 2000


Alexander V. Voinov wrote:
> 
> Please remind me, if there are any performance penalties in nesting
> functions like this:
> 
> def f1():
> 	....
> 	def f2(x)
> 		....
> 
> 	y = f2(x)
> 
> 
> or one should follow the C style? (Definition of f2 in _not_ in a loop,
> of course)

The main issue is scoping and names. Nested functions get 
really messy when they need reference to something outside 
themselves.

- Gordon




More information about the Python-list mailing list