On Fri, Oct 18, 2019 at 5:25 AM Anders Hovmöller <bo...@killingar.net> wrote:
>
>
>
> > On 17 Oct 2019, at 17:07, Andrew Barnert <abarn...@yahoo.com> wrote:
> >
> > On Oct 17, 2019, at 05:08, Anders Hovmöller <bo...@killingar.net> wrote:
> >>
> >> Well obviously never with literals. But most cases of multiplication 
> >> aren't with literals. 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 neither one is a number—in fact, if b is not an integer—you will get a 
> > TypeError.
> >
> > Also, the reason you have no idea what’s in these variables is that you 
> > named them a and b instead of something meaningful.
>
> No. The reason I don't know is because this is a hypothetical example. In 
> real code I would "know" BUT BE WRONG because the variable names would be 
> outright lying.
>
> / Anders

So if you had 'separator' and 'width', would the variable names be
outright lying, or would it then be reasonable to multiply a separator
character by a width (eg 80) to create a line?

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/OFBDIOT4SN6FXTLTC4JM5GHXDJJOYDZQ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to