On Thu, Oct 17, 2019 at 11:08 PM Anders Hovmöller <bo...@killingar.net> wrote:
>
> So how can you get a type error when doing
>
> a*b
>
> is the real question.  And the answer is now obvious: any time the programmer 
> thinks a and b are numbers but they are not.
>

If you start with the assumption that multiplication implies numbers,
and then you see multiplication and it's not numbers, then yes, you
may have problems. But why start with that assumption? Why, when you
look at multiplication, should you therefore think that a and b are
numbers?

Instead, start with the assumption that MANY things can be added,
multiplied, etc. Then it's not a logical type error to multiply
strings, add dictionaries (if this proposal goes through), subtract
timestamps, etc. It's just part of coding.

And if you REALLY want early detection of logical type errors, use a
type checker.

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/PXD5JAJTCVSANZMDGTLPLNVN5KA5GEAN/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to