Re: [Python-Dev] (-1)**(1/2)==1?

2006-02-20 Thread Georg Brandl
Jonathan Barbero wrote:
 Hello!
   My name is Jonathan, i´m new with Python.
 
I try this in the command line:
   
 (-1)**(1/2)
 1
 
This is wrong, i think it must throw an exception.
 What do you think?

 1/2
0
 (-1)**0
1

It's fine.

If you want to get a floating point result from dividing,
make one of the two numbers a float:

 1.0/2
0.5


Georg

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] (-1)**(1/2)==1?

2006-02-20 Thread Aahz
Georg,

Please do not respond to off-topic posts on python-dev without
redirecting them to comp.lang.python (or other suitable place).  Thanks!


On Mon, Feb 20, 2006, Georg Brandl wrote:

 Jonathan Barbero wrote:
 Hello!
   My name is Jonathan, i?m new with Python.
 
I try this in the command line:
   
 (-1)**(1/2)
 1
 
This is wrong, i think it must throw an exception.
 What do you think?
 
 1/2
 0
 (-1)**0
 1
 
 It's fine.
 
 If you want to get a floating point result from dividing,
 make one of the two numbers a float:
 
 1.0/2
 0.5


-- 
Aahz ([EMAIL PROTECTED])   * http://www.pythoncraft.com/

19. A language that doesn't affect the way you think about programming,
is not worth knowing.  --Alan Perlis
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] (-1)**(1/2)==1?

2006-02-20 Thread Facundo Batista
2006/2/20, Jonathan Barbero [EMAIL PROTECTED]:

 Hello!
   My name is Jonathan, i´m new with Python.

Hello Jonathan. This list is only for developing Python itself, not
for developing in Python.

You should address this kind of question in comp.lang.python
(available as a newsgroup and a mailing list), see here for
instructions:

   http://www.python.org/community/lists.html


I try this in the command line:

 (-1)**(1/2)
 1

This is wrong, i think it must throw an exception.
 What do you think?

It's OK, because (1/2) is zero, not 0.5.

 1/2
0

Regards,

.Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] (-1)**(1/2)==1?

2006-02-20 Thread Michael Walter
 1/2
0

 (-1) ** (1./2)
Traceback (most recent call last):
  File stdin, line 1, in ?
ValueError: negative number cannot be raised to a fractional power

Regards,
Michael

On 2/20/06, Jonathan Barbero [EMAIL PROTECTED] wrote:
 Hello!
   My name is Jonathan, i´m new with Python.

I try this in the command line:

 (-1)**(1/2)
 1

This is wrong, i think it must throw an exception.
 What do you think?

 Bye.
 Jonathan.


 ___
 Python-Dev mailing list
 Python-Dev@python.org
 http://mail.python.org/mailman/listinfo/python-dev
 Unsubscribe:
 http://mail.python.org/mailman/options/python-dev/michael.walter%40gmail.com



___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com