Storing value with limits in object

Josip i.i at i.i
Sun Jun 22 14:35:26 EDT 2008


> 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.






More information about the Python-list mailing list