Raymond Hettinger <[EMAIL PROTECTED]> added the comment: I question whether this should be done at all. Making the creation of a float even slightly slower is bad. This is on the critical path for all floating point intensive computations. If someone really cares about the memory savings, it is not hard take a single in instance of float and use it everywhere: ZERO=0.0; arr=[ZERO if x == 0.0 else x for x in arr]. That technique also works for 1.0 and -1.0 and pi and other values that may commonly occur in a particular app. Also, the technique is portable to implementations other than CPython. I don't mind this sort of optimization for immutable containers but feel that floats are too granular. Special cases aren't special enough to break the rules. If the OP is insistent, then at least this should be discussed with the numeric community who will have a better insight into whether the speed/space trade-off makes sense in other applications beyond the OP's original case.
Tim, any insights? ---------- assignee: christian.heimes -> tim_one nosy: +rhettinger, tim_one _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4024> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com