Newb ??

Alex Martelli aleax at
Fri Nov 11 16:10:01 CET 2005

Norman Silverstone <norman at> wrote:
> Incidentally, I am only just starting to learn about functions and have
> not come across the module 're'. Also why is it (lo+hi)//2 and not
> (lo+hi)/2.

Using // ensures truncation, which is what you want. A single / may mean
truncating division in the default legacy/compatibility mode, but with
the new division behavior (which one day will become standard) it means
true division, so that for example 1/2 means 0.5 -- better get used to
the new behavior ASAP (which is why you can ask for new division
behavior with -Qnew on Python's commandline or 'from __future__ import
division' at the top of your module -- to help you get used to it).


More information about the Python-list mailing list