classification
Title: Integer converted in tuple without request
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.3
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Gravitania, r.david.murray
Priority: normal Keywords:

Created on 2012-11-05 22:57 by Gravitania, last changed 2012-11-06 14:53 by Gravitania. This issue is now closed.

Files
File name Uploaded Description Edit
GCD_MCD_Euclides_Extendido-0.py Gravitania, 2012-11-05 22:57 Euclides
Messages (3)
msg174945 - (view) Author: Rosa Maria (Gravitania) * Date: 2012-11-05 22:57
in instruction:
  b = int(input('Dame valor (mayor) de b = '))

later is an instruction:
  while b > 0:

and the result is:
  Traceback (most recent call last):
  File "H:\Soft_nuevo\Reptil\GCD_MCD_Euclides_Extendido-0.py", line 39, in <module>
    while b > 0:
TypeError: unorderable types: tuple() > int()
msg174950 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-11-05 23:17
You did request a tuple:

  r = a - q * b,

That is equivalent to

  r = (a - q * b,)

which is a single element tuple.

I had to put in some print statements in your loop to find that, it wasn't obvious.  This is perhaps a disadvantage of Python's tuple notation, but the benefits of the notation outweigh this small disadvantage, I think.
msg174969 - (view) Author: Rosa Maria (Gravitania) * Date: 2012-11-06 14:53
Thanks Thanks Thanks Thanks Thanks Thanks Thanks you very much,

You are going to go to heaven with your shoes included.

Best regards and have a nice year end.

Rosa María

 
"Cuídate de la Ciencia que no Llora, de la Filosofía que no Ríe y de la Grandeza que no se inclina ante los niños"

"Madre es el nombre de dios en los labios y en los corazones de todos los niños"

>________________________________
> De: R. David Murray <report@bugs.python.org>
>Para: rosemeer@yahoo.com.mx 
>Enviado: Lunes, 5 de noviembre, 2012 17:17:35
>Asunto: [issue16417] Integer converted in tuple without request
> 
>
>R. David Murray added the comment:
>
>You did request a tuple:
>
>  r = a - q * b,
>
>That is equivalent to
>
>  r = (a - q * b,)
>
>which is a single element tuple.
>
>I had to put in some print statements in your loop to find that, it wasn't obvious.  This is perhaps a disadvantage of Python's tuple notation, but the benefits of the notation outweigh this small disadvantage, I think.
>
>----------
>nosy: +r.david.murray
>resolution:  -> invalid
>stage:  -> committed/rejected
>status: open -> closed
>type: crash -> behavior
>
>_______________________________________
>Python tracker <report@bugs.python.org>
><http://bugs.python.org/issue16417>
>_______________________________________
>
>
>
History
Date User Action Args
2012-11-06 14:53:45Gravitaniasetmessages: + msg174969
2012-11-05 23:17:35r.david.murraysetstatus: open -> closed

type: crash -> behavior

nosy: + r.david.murray
messages: + msg174950
resolution: not a bug
stage: resolved
2012-11-05 22:57:08Gravitaniacreate