[Python-Dev] Decimal(unicode)

Facundo Batista facundobatista at gmail.com
Wed Mar 26 04:07:57 CET 2008


2008/3/25, Alex Martelli <aleaxit at gmail.com>:

> >  Since we have some strong use cases at least for the bytes->int case,
>  >  consistency then suggests that the other numeric types should all accept
>  >  bytes as well (interpreting them as ASCII encoded strings).
>
> +1 -- it seems very practical as well as consistent, and I see no downsides.

Mmm... Py3k-ish speaking....

"2.13" is an unicode string that holds four digits, two point one
three, which if converted to Decimal, gives me, well, Decimal("2.13").

b"2.13", as it's not a string of digits anymore, but a stream of 4
bytes, that represents the binary number 0x322e3133...

So, what I find difficult to know is how can you undoubtly express a
collection of digits (inherent to strings) through bytes (without
mixing pre-3k concepts).

Regards,

-- 
.    Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/


More information about the Python-Dev mailing list