[pypy-dev] More strategies

Armin Rigo arigo at tunes.org
Thu Nov 14 10:57:36 CET 2013


Hi Laurence,

On Thu, Nov 14, 2013 at 10:47 AM, Laurence Tratt <laurie at tratt.net> wrote:
> I think that question can only really be answered by trying it out and seeing
> what the benchmarks say. My guess is that you still want both, but if people
> mix ints and floats even more often than I think they do, it may be the case
> that FloatListStrategy kicks in pretty rarely.

Bah, there is another issue.  The following code happens to work right now:

    x, = struct.unpack("d", "ABCDxx\xff\x7f")
    y = struct.pack("d", x)
    assert y == "ABCDxx\xff\x7f"

This works even though x happens to be a NaN; its bit pattern is
preserved.  Such an x could not be stored into a
FloatIntegerListStrategy: if it has the wrong bit pattern, we'd get
the nonsensical result that storing it in a list and reading it back
gives us suddenly an integer object with a random value...

Unsure what to do about that.


A bientôt,

Armin.


More information about the pypy-dev mailing list