This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ezio.melotti
Recipients docs@python, ezio.melotti, pwuertz, rhettinger, serhiy.storchaka
Date 2012-10-25.17:50:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1351187421.67.0.142747290225.issue16239@psf.upfronthosting.co.za>
In-reply-to
Content
> >-      x = x * 2 - 1
> >-      hypot2 = x * x + y * y
>
> Why you remove this?

As I explained in my previous message, even if valid, these are IMHO less clear than x*2 - 1 and x*x + y*y.

> >-      c = (a+b) * (a-b)
> >+      c = a+b * a-b
>
> This changes the semantic.

It does indeed, but I think it's worth pointing out that misleading spacing should be avoided.  Maybe a different example could be used.

> >but otoh 'x*2 - 1' is a better alternative.
>
> Can you justify this?

x*2 - 1  gives a visual hint of what gets executed first,
x * 2-1  gives a wrong/misleading hint of what gets executed first,
x * 2 - 1 gives no hint at all.

I think that providing the correct hint is better than not providing any hints (and clearly better than providing the wrong hint!).
History
Date User Action Args
2012-10-25 17:50:21ezio.melottisetrecipients: + ezio.melotti, rhettinger, docs@python, serhiy.storchaka, pwuertz
2012-10-25 17:50:21ezio.melottisetmessageid: <1351187421.67.0.142747290225.issue16239@psf.upfronthosting.co.za>
2012-10-25 17:50:21ezio.melottilinkissue16239 messages
2012-10-25 17:50:21ezio.melotticreate