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/059826.html below:

[Python-Dev] str with base

[Python-Dev] str with baseAndrew Bennetts andrew-pythondev at puzzling.org
Tue Jan 17 15:30:48 CET 2006
On Tue, Jan 17, 2006 at 09:23:29AM -0500, Jason Orendorff wrote:
> It seems dumb to support *parsing* integers in weird bases, but not
> *formatting* them in weird bases.  Not a big deal, but if you're going
> to give me a toy, at least give me the whole toy!
> 
> The %b idea is a little disappointing in two ways.  Even with %b,
> Python is still dumb by the above criterion.  And, I suspect users
> that don't know about %b are unlikely to find it when they want it.  I
> know I've never looked for it there.
> 
> I think a method 5664400.to_base(13) sounds nice.

It's also a SyntaxError.  With the current syntax, it would need to be
"(5664400).to_base(13)" or "5664400 .to_base(13)".

Why not just make the %b take a base, e.g.: 
    '%13b' % 5664400

<wink>

-Andrew.

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