[Python-ideas] Making stars optional? (was: Making colons optional?)

Chris Rebert pyideas at rebertia.com
Thu Feb 5 19:51:04 CET 2009

On Thu, Feb 5, 2009 at 10:30 AM, Bruce Leban <bruce at leapyear.org> wrote:
> In algebra, you don't have to put a multiplication sign in between two
> quantities that you want to multiply. I've seen beginning programmers write
> things like
>     x = 3a + 4(b-c)
> instead of
>     x = 3*a + 4*(b-c)
> Why should we require the stars when it's unambiguous what the first
> statement means?

Because there's a /very/ high likelihood that it was typo, and per the
Zen, Python shouldn't guess in the face of ambiguity and (likely)
errors should never pass silently. Further, if it is a typo, it's not
unambiguous enough that we can infer with certainty that
multiplication was intended; it's just as likely the programmer forgot
to type the operator, and there's only a 1 in 11 (or worse) (that's
how many binary operators I could come up with without looking at the
manual) chance that multiplication was indeed intended.


Follow the path of the Iguana...

More information about the Python-ideas mailing list