You are trying to run code in a class that does not exist yet.
def Demo(): def fact(n): if n < 2: return 1 else: return n * fact(n - 1) return type("Demo", (object,), {"fact": staticmethod(fact), "_classvar": fact(5)}) Demo = Demo() d = Demo() print d._classvar # prints 120 print d.fact(7) # prints 5040 print Demo # prints <class '__main__.Demo'> -- Stephen Fairchild -- http://mail.python.org/mailman/listinfo/python-list