Proposal: Decimal literals in Python.

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sat Oct 27 01:52:04 EDT 2007


On Fri, 26 Oct 2007 19:29:47 -0400, J. Cliff Dyer wrote:

> Ben Finney wrote:
>> So, the original poster might get further by proposing an '0dNNN.NNN'
>> syntax for 'decimal.Decimal' literals. 
> It would rather be remarkably inconsistent and confusing. 
> 
> Python 3.0a1 (py3k:57844, Aug 31 2007, 16:54:27) [MSC v.1310 32 bit
> (Intel)] on win32
> <snip>
>>>> type(0b1)
> <type 'int'>
>>>> type(0o1)
> <type 'int'>
>>>> type(0x1)
> <type 'int'>
>>>> assert 0b1 is 0x1
>>>>

That this doesn't raise `AssertionError` is an implementation detail. 
It's not guaranteed the two objects are really the same.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list