The REALLY bad thing about Python lists ..
mjackson at wc.eso.mc.xerox.com
Tue May 23 15:15:00 CEST 2000
Ivan Van Laningham <ivanlan at home.com> writes:
> Russell Wallace wrote:
> > Glyph Lefkowitz wrote:
> > >
> > > "Tim Peters" <tim_one at email.msn.com> 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.
It's also an easy thing to overlook. The freeware to-do list manager
XVTDL came with an implementation of the Zeller day-of-the-week
algorithm that breaks in March, 2000 precisely because of this.
Although the misbehavior was identified in 1994 it didn't get diagnosed
and fixed until this year (when the matter became urgent for the few of
us still using the program).
Mark Jackson - http://www.alumni.caltech.edu/~mjackson
In judging others, folks will work overtime for no pay.
- Charles Carruthers
More information about the Python-list