[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Old Man Yells At Cloud

On Sun, 17 Sep 2017 02:52 am, Dennis Lee Bieber wrote:

> Yes -- that would give me fits if I were using Python3 currently...
> Since so many of the languages I've learned over the past years use the
> concept               integer / integer => integer_result

That would be C, and C derived languages, perhaps?

Pascal uses integer / integer => float (except Pascal calls it "Real"). If you
want integer division, use "div".

I think so did Algol.

> Come to think of it -- wasn't there a post from someone (seems to
> expired or been filtered from my client) asking for help with some sorting
> program... I'm pretty sure the partitioning logic would croak on Python3
> due to floating point results in the slice indices:
> pA = part[:n/2]
> pB = part[n/2:]

If you want integer division, you have to use integer division :-)

pA = part[:n//2]

?Cheer up,? they said, ?things could be worse.? So I cheered up, and sure
enough, things got worse.