Skip to main content
2 of 2
Copy edited (ref. <http://en.wikipedia.org/wiki/Python_%28programming_language%29>).

Why not compare your needs to something that exists in the standard Python library, and then see how that is implemented?

Note, if you don't need an object, you can still define functions within functions. With Python 3 there is the new nonlocal declaration to allow you to change variables in your parent function.

You might still find it useful to have some simple private classes inside your function to implement abstractions and tidying up operations.

meuh
  • 151
  • 1
  • 5