On 1/17/06, Thomas Wouters <[EMAIL PROTECTED]> wrote:
> On Tue, Jan 17, 2006 at 09:23:29AM -0500, Jason Orendorff wrote:
>
> > I think a method 5664400.to_base(13) sounds nice.
> [And others suggested int-methods too]
>
> I would like to point out that this is almost, but not quite, entirely as
> inapropriate as using str(). Integers don't have a base. String
> representations of integers -- and indeed, numbers in general, as the Python
> tutorial explains in Appendix B -- have a base. Adding such a method to
> integers (and, I presume, longs) would beg the question why floats, Decimals
> and complex numbers don't have them.

I dream of a day when str(3.25, base=2) == '11.01'.  That is the
number a float really represents.  It would be so much easier to
understand why floats behave the way they do if it were possible to
print them in binary.

To be fair, it's not str(x, base=n) I'm after here (although it seems
like a clean way to do it.)  Rather, I just want SOME way of printing
ints and floats in binary.


> In-favour-of-%2b-ly y'rs,

My only opposition to this is that the byte type may want to use it. 
I'd rather wait until byte is fully defined, implemented, and released
in a python version before that option is taken away.

--
Adam Olsen, aka Rhamphoryncus
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to