Python – I need __closure__

pythonpython-3.x

I just checked out this very interesting mindmap:

http://www.mindmeister.com/10510492/python-underscore

And I was wondering what some of the new ones mean, like __code__ and __closure__. I googled around but nothing concrete. Does anyone know?

Best Answer

From What's New in Python 3.0

The function attributes named func_X have been renamed to use the __X__ form, freeing up these names in the function attribute namespace for user-defined attributes. To wit, func_closure, func_code, func_defaults, func_dict, func_doc, func_globals, func_name were renamed to __closure__, __code__, __defaults__, __dict__, __doc__, __globals__, __name__, respectively.

Basically, same old Python 2 stuff, fancy new Python 3000 name.

You can learn more about most of these in PEP 232