[Python-Dev] bytes thoughts

Josiah Carlson jcarlson at uci.edu
Fri Mar 17 01:47:37 CET 2006


Baptiste Carvello <baptiste13 at altern.org> wrote:
> Josiah Carlson a écrit :
> 
> > They aren't considered because they are *obvious* to most (if not all)
> > sane people who use Python.  
> 
> They are not *that* obvious. Logical operations on ints have allowed users to 
> forget about size (and shoot themselves in the foot from time to time). Or is
> 1^(~1) == -1 obvious ? Well, maybe that's not sane either :-)

I find most operations involving ~ to be insane (just a personal opinion),
but in this case, if one assumes two's compliment arithmetic (which
seems fairly reasonable considering current standard platforms), an
integer, all of whose bits are 1, dictates that the value be -1.  An
insane use of ~, but a sane result.  *shrug*

 - Josiah



More information about the Python-Dev mailing list