converting decimal to binary

Tim Peters tim_one at email.msn.com
Sat May 24 22:22:55 EDT 2003


[Bengt Richter]
> I liked the literal pattern suggested for hex by someone whose name
> I've forgotten (I'm obviously using a regex to express it here):
>
>     [01][xX][0123456789abcdefABCDEF]+
>
> where the [01] indicated the sign bit to extend leftwards (so e.g.,
> -1 == 1xF)

I think that was Greg Ewing's suggestion.  I like it too!  Last time I asked
Guido, he didn't think it was important enough to bother changing, though.

[Dan Bishop]
> But how will that work after int/long unification?

Exactly the same -- it's just another way to spell bit patterns.






More information about the Python-list mailing list