The REALLY bad thing about Python lists ..

Ivan Van Laningham ivanlan at
Tue May 23 14:57:25 CEST 2000

Hi All--

Russell Wallace wrote:
> Glyph Lefkowitz wrote:
> >
> > "Tim Peters" <tim_one at> writes:
> > > ISO/ANSI C doesn't fully define what happens when (roughly) integer division
> > > or % are handed negative numbers.
> >
> > The foibles of standards commitees will never cease to amuse me.
> > Thank you for this little tidbit.
> Don't blame the C committee, blame the CPU manufacturers.  C doesn't
> define the result because CPUs aren't consistent about what result they
> give.
> (Under what circumstances would you want to use % on negative numbers?
> I can't think of any.)

Calendrical mathematics often has a use for negative modulo.  However,
it's an easy matter to check the inputs and set the sign on the answer.

<zero-minus-one>-ly y'rs,
Ivan Van Laningham
Axent Technologies, Inc.
Army Signal Corps:  Cu Chi, Class of '70
Author:  Teach Yourself Python in 24 Hours

More information about the Python-list mailing list