Re: Binary Decimals in Python
- From: Patrick Maupin <pmaupin@xxxxxxxxx>
- Date: Tue, 30 Mar 2010 08:28:50 -0700 (PDT)
On Mar 30, 10:13 am, aditya <bluemangrou...@xxxxxxxxx> wrote:
To get the decimal representation of a binary number, I can just do
this:
int('11',2) # returns 3
But decimal binary numbers throw a ValueError:
int('1.1',2) # should return 1.5, throws error instead.
Is this by design? It seems to me that this is not the correct
behavior.
- Aditya
So, why should int('1.1', 2) throw an error when int('1.1') doesn't?
Regards,
Pat
.
- Follow-Ups:
- Re: Binary Decimals in Python
- From: Steven D'Aprano
- Re: Binary Decimals in Python
- References:
- Binary Decimals in Python
- From: aditya
- Binary Decimals in Python
- Prev by Date: Binary Decimals in Python
- Next by Date: Re: sum for sequences?
- Previous by thread: Binary Decimals in Python
- Next by thread: Re: Binary Decimals in Python
- Index(es):