On 04/13/2011 07:37 PM, Eric Snow wrote:
I suppose you could try something like this:

class Outer:
  global Inner
  class Inner:
    class Worker:
      pass

  class InnerSubclass(Inner):
    class Worker(Inner.Worker):
      pass

However, that pollutes your global namespace. If you are worried about that you could try: [...]

It also means that Inner is not actually /in/ Outer, and the whole point was to have the class accessed as Outer.Inner. But I can get what I wanted, if immediately after the definition of Outer I have:

   Outer.Inner = Inner
   del Inner


Thanks for the suggestion of "global Inner"! That makes this approach palatable.


/larry/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to