What is considered an "advanced" topic in Python?

Chris Angelico rosuav at gmail.com
Mon Jun 1 09:52:45 EDT 2015


On Mon, Jun 1, 2015 at 9:24 PM, Laura Creighton <lac at openend.se> wrote:
> In a message of Mon, 01 Jun 2015 20:36:14 +1000, Chris Angelico writes:
>>The problem isn't the decimal separator, though, because floats can
>>have problems even without it (and can have no problems with a decimal
>>separator). If you want to distinguish "computer numbers" from "real
>>numbers", you'd do better to pick a different set of symbols for them
>>- or at least a different numerical base. If all literals were written
>>in octal, people would understand that there's something special going
>>on here. But would that really help?
>
> Maybe _your_ brain needs some resetting, too. :)  You know too much so
> have lost the grasp of how the world looks to the new programmer.
>
> Problem:
> I want to use a computer to add up a whole lot of money amounts so I can
> figure out how much money to send some place.
>
> And they immediately grab floating point numbers...

That part I do understand; floating-point is the one obvious way to do
these sorts of things. I'm fairly sure we agree that a novice *will*,
for better or for worse, stumble upon floats - in pretty much any
language.

The question is, what part of float is wrong? I don't think the
problem is with the decimal separator, and therefore laying them out
as "whole part, colon, fractional part" won't necessarily help. And it
can potentially hurt, by teaching people that computers are just
weird, and you have to speak a weird language to talk to them -
without understanding that there's a real difference behind this. It's
like the eternal debate about assignment and whether "x = x + 1" is
nonsense, with advocates preferring "x := x + 1" as being somehow
fundamentally different. It isn't. It's just a notational change, and
not even a huge one. (Though I do see the line of argument that it
should be "x <- x + 1" or something else that looks like an arrow.)

ChrisA



More information about the Python-list mailing list