Re: [Python-Dev] PEP 515: Underscores in Numeric Literals

2016年2月11日 08:58:55 -0800

On Feb 11, 2016, at 00:22, Georg Brandl <[email protected]> wrote:
> 
> Allowing underscores in string arguments to the ``Decimal`` constructor. It
> could be argued that these are akin to literals, since there is no Decimal
> literal available (yet).
I'm +1 on this. Partly for consistency (see below)--but also, one of the use 
cases for Decimal is when you need more precision than float, meaning you'll 
often have even more digits to separate.
> * Allowing underscores in string arguments to ``int()`` with base argument 0,
> ``float()`` and ``complex()``.
+1, because these are actually defined in terms of literals. For example, under 
int, "Base 0 means to interpret exactly as a code literal". This isn't actually 
quite true, because "-2" is not an integer literal but is accepted here--but 
see float for an example that *is* rigorously defined, and still defers to 
literal syntax and semantics.
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to