ananthakrishnan15.2001ï¼ gmail.com wrote:

> >>> binary.ones_complement(11011011110001)
> 00100100001110

I see. So you want `binary.ones_complement` to accept a nonnegative Python 
`int` whose decimal expansion consists entirely of ones and zeros, interpret 
that decimal expansion as though it's a bit-string, complement, and then return 
another such Python `int`. Is that correct? Note that in that case, the output 
you'd get above would be `100100001110`, not `00100100001110`.

Quite apart from whether this is a good idea or not, I can't see how this could 
even work.  Can you please answer the following?

1. What would you expect `ones_complement(1100)` to return? (I'm guessing you'd 
expect a Python `int` with value `11`.)
2. What about `ones_complement(11111100)`? (I'm guessing that you'd also expect 
a Python `int` with value `11` here.)
3. What would `ones_complement(ones_complement(1100))` be?
4. What would `ones_complement(ones_complement(11111100))` be?
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/XCFO5ZK27CSP6QPPDWTUI6AZY2O22YRW/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to