PEP 238 (revised)

Tom Jenkins tjenkins at nospiced.ham.devis.com
Thu Jul 26 21:51:36 EDT 2001


Guido van Rossum wrote:

[snip]

> 
> PEP: 238
> Title: Non-integer Division
> Version: $Revision: 1.10 $
> Author: pep at zadka.site.co.il (Moshe Zadka), guido at python.org (Guido van Rossum)
> 
[snip]

> 
> Command Line Option
> 
>     The -D command line option takes a string argument that can take
>     three values: "old", "warn", or "new".  The default is "old" in
>     Python 2.2 but will change to "warn" in later 2.x versions.  The
>     "old" value means the classic division operator acts as described.
>     The "warn" value means the classic division operator issues a
>     warning (a DeprecatinWarning using the standard warning framework)
>     when applied to ints or longs.  The "new" value changes the
>     default globally so that the / operator is always interpreted as
>     true division.  The "new" option is only intended for use in
>     certain educational environments, where true division is required,
>     but asking the students to include the future division statement
>     in all their code would be a problem.


I'm wondering if these command line options are too "generic" and not 
explicit enough.  Possibly
  -Dold_division
  -Dwarn_division
  -Dnew_division
give more information as to what the options mean?

[snip]

> 
> Semantics of Floor Division
> 
>     Floor division will be implemented in all the Python numeric
>     types, and will have the semantics of
> 
>         a // b == floor(a/b)
> 
>     except that the type of a//b will be the type a and b will be
>     coerced into.  Specifically, if a and b are of the same type, a//b
>     will be of that type too.
> 


I'm not sure I understand this part.  Could you throw in an example? 
Does it mean that if 'a' and 'b' are floats then a//b would return a 
float?  For example 3.5//2.0 == 1.0?

[snip]


Tom




More information about the Python-list mailing list