A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-January/059815.html below:

[Python-Dev] str with base

[Python-Dev] str with base [Python-Dev] str with baseNick Craig-Wood nick at craig-wood.com
Tue Jan 17 11:05:44 CET 2006
On Mon, Jan 16, 2006 at 11:13:27PM -0500, Raymond Hettinger wrote:
> My reason is that I've rolled-my-own more times than I can count but
> infrequently enough to where it was easier to re-write than to search
> for the previous use.

Me too!  The assymetry is annoying.  Its easy to consume base 2..36
integers, but its hard to generate them.

However str() seems far too important to monkey with to me.

I like a method on int that would be great.  That keeps all the base
conversions in int (either in __init__ or in as_yet_unnamed_method()).

Another suggestion would be to give hex() and oct() another parameter,
base, so you'd do hex(123123123, 2). Perhaps a little
counter-intuitive, but if you were looking for base conversion
functions you'd find hex() pretty quickly and the documentation would
mention the other parameter.

-- 
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4