semantics of ** (unexpected/inconsistent?)

inhahe inhahe at gmail.com
Mon Nov 30 06:41:06 EST 2009


one point of confusion could be the use of ** instead of superscript.
it might make things a little bit more counterintuitive-looking than
with superscripts, since the issue with
 would only apply to exponents, as

-5*4

and

a = -5
a*4

return the same answer, and superscripts make it a little easier to
associate the exponent value with the base more than with the - before
it.

On Mon, Nov 30, 2009 at 3:46 AM, Gregory Ewing
<greg.ewing at canterbury.ac.nz> wrote:
> Esmail wrote:
>
>> Wow .. never heard of Concatenative_languages languages before or the
>> distinction you make. Your distinction explains the behavior, but I
>> find it somewhat counter-intuitive.
>
> You shouldn't find it any more surprising than the fact that
>
>  a = 2 + 3
>  print a * 5
>
> gives a different result from
>
>  print 2 + 3 * 5
>
> --
> Greg
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list