[Python-ideas] Re: int.to_base, int.from_base

2022-05-02 Thread Steven D'Aprano
On Mon, May 02, 2022 at 09:58:35AM +0200, Marc-Andre Lemburg wrote: > Just a word of warning: numeric bases are not necessarily the same > as numeric encodings. The latter usually come with other formatting > criteria in addition to representing numeric values, e.g. base64 is > an encoding and not

[Python-ideas] Re: int.to_base, int.from_base

2022-05-02 Thread Chris Angelico
On Mon, 2 May 2022 at 17:58, Marc-Andre Lemburg wrote: > > On 02.05.2022 08:54, Chris Angelico wrote: > > On Mon, 2 May 2022 at 16:46, Serhiy Storchaka wrote: > >> > >> 02.05.22 08:03, Chris Angelico пише: > >>> Let's not go as far as a PEP yet, and figure out a couple of things: > >> > >> A PEP

[Python-ideas] Re: int.to_base, int.from_base

2022-05-02 Thread Marc-Andre Lemburg
On 02.05.2022 08:54, Chris Angelico wrote: > On Mon, 2 May 2022 at 16:46, Serhiy Storchaka wrote: >> >> 02.05.22 08:03, Chris Angelico пише: >>> Let's not go as far as a PEP yet, and figure out a couple of things: >> >> A PEP is necessary if we add Roman numerals and Cyrillic numerals, and >> Baby

[Python-ideas] Re: int.to_base, int.from_base

2022-05-01 Thread Chris Angelico
On Mon, 2 May 2022 at 16:46, Serhiy Storchaka wrote: > > 02.05.22 08:03, Chris Angelico пише: > > Let's not go as far as a PEP yet, and figure out a couple of things: > > A PEP is necessary if we add Roman numerals and Cyrillic numerals, and > Babylonian cuneiform numerals to the heap. > I'm awar

[Python-ideas] Re: int.to_base, int.from_base

2022-05-01 Thread Chris Angelico
On Mon, 2 May 2022 at 16:37, Simon de Vlieger wrote: > > On Mon, May 2, 2022, at 7:03 AM, Chris Angelico wrote: > > The "alternate alphabet" case can be done by base converting and then > > replacing on the string. It's not the smoothest, so that counts a bit > > of clunkiness; but it's also not a

[Python-ideas] Re: int.to_base, int.from_base

2022-05-01 Thread Serhiy Storchaka
02.05.22 08:03, Chris Angelico пише: Let's not go as far as a PEP yet, and figure out a couple of things: A PEP is necessary if we add Roman numerals and Cyrillic numerals, and Babylonian cuneiform numerals to the heap. ___ Python-ideas mailing lis

[Python-ideas] Re: int.to_base, int.from_base

2022-05-01 Thread Simon de Vlieger
On Mon, May 2, 2022, at 7:03 AM, Chris Angelico wrote: > The "alternate alphabet" case can be done by base converting and then > replacing on the string. It's not the smoothest, so that counts a bit > of clunkiness; but it's also not all THAT common (I can recall doing > it for SteamGuard 2FA codes

[Python-ideas] Re: int.to_base, int.from_base

2022-05-01 Thread Chris Angelico
On Mon, 2 May 2022 at 14:49, Simon de Vlieger wrote: > > Hey there, > > The `int()` function allows to specify a base to convert from, for example: > > >>> int("foo", 26) > 10788 > > Which is documented as: > > > The base defaults to 10. Valid bases are 0 and 2-36. > > For other common bases func