ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> activepython
activepython
New // operator
by Matthew Sherborne other posts by this author
Apr 29 2002 10:23PM messages near this date
view in the new Beta List Site
Re: was (no subject) + new thread | Re: New // operator
On Python 2.2 I like the new div operator //, which I likened to =
Delphi's 'div' ie. Integer Division. However I surprised to realize that =
not only 5//2=3D=3D2 but that I can also say that 5 // 1.5 =3D=3D 3.0!

So I now realize that it is not "Integer Division", it is "Division with =
the result rounded down".

I hope that I will still be able to 5 // 1.5 in future versions of =
python because I'm putting it in my prorgam!

It's shorter than 'from math import floor; floor(5/1.5);'.

> >> from __future__ import
> >> 5 // 1.5
3.0
> >> 5 / 1.5
3.3333333333333335

Amazing! Thanks Guido and friends :)
Matthew Sherborne
Attachments:
unknown1

Thread:
Matthew Sherborne
Syver Enstad
Eric Sloane
Kari Hoijarvi
David Ascher
Jeff Shannon
David Ascher

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved