[Bob Ippolito] > What should it be called instead of wrapping? I don't know -- I don't know what it's trying to _say_ that isn't already said by saying that the input is out of bounds for the format code.
> When it says it's wrapping, it means that it's doing x &= (2 ^ (8 * n)) - 1 > to force > a number into meeting the expected range. How is that different from what it does in this case?: >>> struct.pack('<B', 256L) /Users/bob/src/python/Lib/struct.py:63: DeprecationWarning: 'B' format requires 0 <= number <= 255 return o.pack(*args) '\x00' That looks like "wrapping" to me too (256 & (2**(8*1)-1)== 0x00), but in this case there is no deprecation warning about wrapping. Because of that, I'm afraid you're drawing distinctions that can't make sense to users. > Reducing it to one warning instead of two is kinda difficult. Is it > worth the trouble? I don't understand. Every example you gave that showed a wrapping warning also showed a "format requires i <= number <= j" warning. Are there cases in which a wrapping warning is given but not a "format requires i <= number <= j" warning? If so, I simply haven't seen one (but I haven't tried all possible inputs ;-)). Since the implementation appears (to judge from the examples) to "wrap" in every case in which any warning is given (or are there cases in which it doesn't?), I don't understand the point of distinguishing between wrapping warnings and "format requires i <= number <= j" warnings either. The latter are crystal clear. _______________________________________________ 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