Very weird bug!

S

ssecorp

I was looking into currying and

Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
(Intel)] on win32
Type "copyright", "credits" or "license()" for more information.

****************************************************************
Personal firewall software may warn about the connection IDLE
makes to its subprocess using this computer's internal loopback
interface. This connection is not visible on any external
interface and no data is sent to or received from the Internet.
****************************************************************

IDLE 1.2.2
Traceback (most recent call last):
File "<pyshell#14>", line 1, in <module>
fac
NameError: name 'fac' is not defined
Traceback (most recent call last):
File "<pyshell#15>", line 1, in <module>
factorial
NameError: name 'factorial' is not defined
Traceback (most recent call last):
File "<pyshell#18>", line 1, in <module>
math.factorial
AttributeError: 'module' object has no attribute 'factorial'
Traceback (most recent call last):
File "<pyshell#19>", line 1, in <module>
math.fac
AttributeError: 'module' object has no attribute 'fac'['__doc__', '__name__', 'acos', 'asin', 'atan', 'atan2', 'ceil',
'cos', 'cosh', 'degrees', 'e', 'exp', 'fabs', 'floor', 'fmod',
'frexp', 'hypot', 'ldexp', 'log', 'log10', 'modf', 'pi', 'pow',
'radians', 'sin', 'sinh', 'sqrt', 'tan', 'tanh']
Traceback (most recent call last):
File "<pyshell#22>", line 1, in <module>
tan
NameError: name 'tan' is not defined return a+b
a=x+y
return a
return n + p
return n+p
return a+b

Traceback (most recent call last):
File "<pyshell#44>", line 1, in <module>
build(5,4)
File "<pyshell#43>", line 2, in build
return a+b
TypeError: cannot concatenate 'str' and 'function' objects yreturn x+

SyntaxError: invalid syntax return x+y
return a+b




wtf was this in the middle!?
return a+b
(5, 4)
 
T

Terry Reedy

ssecorp said:
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
wtf was this in the middle!?
return a+b
(5, 4)

I have exactly the same build on Windows and get the expected 9.

Try it again.
 
S

ssecorp

i know, idid try it again and it works as expected. but how the h***
did it not work that one time?
 
J

Jorgen Bodde

Maybe the interpreter remembered the values of some objects you used?
If you type in the interpreter, the objects you create have a lifetime
as long as the interpreter is active, which means it can get a state
behaviour that otherwise is not present if you start a new interpreter
instance. To be safe you should always try it with a script and run it
from the commandline to get the same 'state' everytime your script
runs.

- Jorgen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top