> I bet you didn't even try this, unless your definition of "works" > includes a "RuntimeError: maximum recursion depth exceeded". Here's a > a working version:
Actually, the version I'm using is somewhat bigger. I removed docstrings and recklessly stripped away some methods to make it shorter concise and incorrect. > For (most) math.* functions it suffices to define __float__, so the > above works. For making it behave (almost) like a regular number, > you'd have to write many more special methods: > http://docs.python.org/ref/numeric-types.html. > Here's a possible start: > (...) Yes, this is very close to what I was looking for. It implements all the functionality except asssigning values. And speed is not an issue for my application. Thanks. -- http://mail.python.org/mailman/listinfo/python-list