[Python-Dev] str with base

Nick Coghlan ncoghlan at gmail.com
Thu Jan 19 21:56:23 CET 2006


Guido van Rossum wrote:
> On 1/19/06, Fredrik Lundh <fredrik at pythonware.com> wrote:
>> Guido van Rossum wrote:
>>
>>> I think we ought to let this sit for a while and come back to it in a
>>> few week's time. Is 'base' really the right name? It could just as
>>> well be considered a conversion in the other direction.
>> the same applies to hex and oct, of course.
> 
> Right. And this is not a hypothetical issue either -- in Perl, hex and
> oct *do* work the other way I believe. More reasons to get rid of
> these in Python 3000. Perhaps we should also get rid of hex/oct
> lterals?

I'm not aware of anyone that would miss octal literals, but there are plenty 
of hardware weenies like me that would find "int("DEAD", 16)" less convenient 
than "0xDEAD". Python is a bit too heavyweight for a lot of embedded work, but 
its *great* for writing host-based test harnesses.

I quite like the suggestion of using 'math.base' rather than a builtin, but 
there are still issues to be figured out there:
   - the math module is currently a thin wrapper around C's "math.h". Do we 
really want to change that by adding more methods?
   - is 'base' the right name?
   - should we allow a "digits" argument, or just the radix argument?

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-Dev mailing list