Just leveled up.

I'm on to you, garbage collector...

import math
import sys

class ClassThatWantsToBeAModule(object):
# This line is worth 6000 experience.
_my_module = sys.modules[__name__]
def pi(self):
return math.pi

my_class = ClassThatWantsToBeAModule()
sys.modules[__name__] = my_class

my_class.pi()

No comments:

Post a Comment