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

Bruce Leban bruce at leapyear.org
Thu Feb 5 21:47:59 CET 2009


I apologize for leaving the :-) out in my original post.

Just to be clear: (1) I indeed have seen this mistake from beginning
programmers and (2) I think they should get over it.

I also don't think that = and == should be the same syntax and trust the
compiler to figure out which one you mean.

I also don't think spaces should be optional, despite the fact that no space
probe has ever been lost as a result of that feature. :-(

http://my.safaribooksonline.com/0131774298/ch02
http://catless.ncl.ac.uk/Risks/9.54.html

--- Bruce

On Thu, Feb 5, 2009 at 11:04 AM, Curt Hagenlocher <curt at hagenlocher.org>wrote:

> 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?
>
> Sure, and given the following program:
>    a = 2
>    b = 4
>    print ab
> shouldn't we be able to print "8", given that the meaning of the
> program is unambiguous?
>

That would be so cool! If any variable is undefined, break it up into
smaller variables and if they're numbers multiply them and if they're
strings concatenate them. Wow!

>
>
> Ultimately, you have to balance ease-of-use against consistency --
> both because too much inconsistency can actually harm ease-of-use and
> because "special cases" tend to combine in crazy ways to create
> horrible edge cases.  Where to draw the line is always a matter of
> personal taste, but the Python language has consistently favored
> consistency in its philosophy.
>
> --
> Curt Hagenlocher
> curt at hagenlocher.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090205/b3decccf/attachment.html>


More information about the Python-ideas mailing list