[Python-ideas] Backward-incompatible changes for Python 4

Antoine Pitrou solipsis at pitrou.net
Mon Apr 1 10:50:30 EDT 2019


On Mon, 1 Apr 2019 10:41:40 -0400
Dan Sommers
<2QdxY4RzWzUUiLuE at potatochowder.com>
wrote:
> On 4/1/19 10:27 AM, Antoine Pietri wrote:
> 
> > - The / operator returns floats, which loses information when both of
> > the operands are integer. In Python 4, “1 / 2” should return a
> > decimal.Decimal. To ease the transition, we propose to add a new “from
> > __future__ import decimal_division” in Python 3.9 to enable this
> > behavior.  
> 
> “1 / 2” should be a syntax error.
> 
> "1 / 2" should return a string.
> 
> 1 / 2 should return a fractions.Fraction.

And 01 / 04 / 2019 should return a April 1st datetime.

(except in the US, of course)

Regards

Antoine.




More information about the Python-ideas mailing list