Bizarre arithmetic results

Steven D'Aprano steven at REMOVE.THIS.cybersource.com.au
Tue Feb 23 03:11:52 EST 2010


On Mon, 22 Feb 2010 18:01:44 +0000, Albert van der Horst wrote:

> In article <mailman.2359.1265890457.28905.python-list at python.org>,
> Terrence Cole  <terrence at zettabytestorage.com> wrote:
>>Can someone explain to me what python is doing here?
>>
>>Python 3.1.1 (r311:74480, Feb  3 2010, 13:36:47) [GCC 4.3.4] on linux2
>>Type "help", "copyright", "credits" or "license" for more information.
>>>>> -0.1 ** 0.1
> 
> Python 4.0
> Warning: misleading blank space, expected:
>   - 0.1**0.1
> 
>>-0.7943282347242815


Making spaces significant in that fashion is mind-bogglingly awful. Let's 
look at a language that does this:

[steve at sylar ~]$ cat ws-example.rb
def a(x=4)
    x+2
end

b = 1
print (a + b), (a+b), (a+ b), (a +b), "\n"


[steve at sylar ~]$ ruby ws-example.rb
7773




-- 
Steven



More information about the Python-list mailing list