Newbie question about function return values

Chad Netzer cnetzer at
Sat Mar 15 02:49:05 CET 2003

On Fri, 2003-03-14 at 17:25, John Machin wrote:

> OOOOOoooopppps, you stuffed up also.
> For 512, this returns 1024.

Yeah, based on the function name I did this purposely.  But yours is
what the original poster seemed to actually want.

> def round_to_higher_mult_of_512(x):
>    return ((x + 511L) // 512L) * 512L
>    # 'L' just in case rounded-up file size >= 2GB

Bay Area Python Interest Group -

Chad Netzer
(any opinion expressed is my own and not NASA's or my employer's)

More information about the Python-list mailing list