On 11/26/06, tomer filiba <[EMAIL PROTECTED]> wrote: > i found several places in my code where i use positive infinity > (posinf) for various things, i.e., > > > i like the concept, but i hate the "1e10000" stuff... why not add > posint, neginf, and nan to the float type? i find it much more readable as: > > if limit < 0: > limit = float.posinf > > posinf, neginf and nan are singletons, so there's no problem with > adding as members to the type.
There's no reason this has to be part of the float type. Just define your own PosInf/NegInf singletons and PosInfType/NegInfType classes, giving them the appropriate special methods. NaN is a bit iffier, but in your case it's sufficient to raise an exception whenever it would be created. Consider submitting it to the Python Cookbook when you're done. ;) -- Adam Olsen, aka Rhamphoryncus _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com