473,796 Members | 2,826 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Very weird bug!

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
>>h = "aja baja"
h += 'e'
h
'aja bajae'
>>h = h+'a'
h
'aja bajaea'
>>a = b = "foo"
a
'foo'
>>b
'foo'
>>a==b
True
>>id(a)
35018400
>>id(b)
35018400
>>a += "bar"
id(a),a
(35110112, 'foobar')
>>id(b),b
(35018400, 'foo')
>>fac
Traceback (most recent call last):
File "<pyshell#1 4>", line 1, in <module>
fac
NameError: name 'fac' is not defined
>>factorial
Traceback (most recent call last):
File "<pyshell#1 5>", line 1, in <module>
factorial
NameError: name 'factorial' is not defined
>>import math
math
<module 'math' (built-in)>
>>math.factoria l
Traceback (most recent call last):
File "<pyshell#1 8>", line 1, in <module>
math.factorial
AttributeError: 'module' object has no attribute 'factorial'
>>math.fac
Traceback (most recent call last):
File "<pyshell#1 9>", line 1, in <module>
math.fac
AttributeError: 'module' object has no attribute 'fac'
>>dir(math)
['__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']
>>pow
<built-in function pow>
>>tan
Traceback (most recent call last):
File "<pyshell#2 2>", line 1, in <module>
tan
NameError: name 'tan' is not defined
>>math.tan
<built-in function tan>
>>def build(a,b):
return a+b
>>build(5,4)
(5, 4)
>>def build(x,y):
a=x+y
return a
>>build(5,4)
9
>>def b(n, p):
return n + p
>>b(1, 10)
11
>>def b(n,p):
return n+p
>>b(5,2)
7
>>def build(x,y):
return a+b
>>build(5,4)
Traceback (most recent call last):
File "<pyshell#4 4>", line 1, in <module>
build(5,4)
File "<pyshell#4 3>", line 2, in build
return a+b
TypeError: cannot concatenate 'str' and 'function' objects
>>def build(x,y):
yreturn x+

SyntaxError: invalid syntax
>>def build(x,y):
return x+y
>>build(5,4)
9
>>def build(a,b):
return a+b
>>build(5,4)
9
>>>

wtf was this in the middle!?
>>def build(a,b):
return a+b
>>build(5,4)
(5, 4)
Jul 6 '08 #1
3 1629
ssecorp wrote:
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
wtf was this in the middle!?
>>>def build(a,b):
return a+b
>>>build(5,4)
(5, 4)
I have exactly the same build on Windows and get the expected 9.

Try it again.

Jul 7 '08 #2
i know, idid try it again and it works as expected. but how the h***
did it not work that one time?
Jul 7 '08 #3
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
On Mon, Jul 7, 2008 at 7:36 PM, ssecorp <ci**********@g mail.comwrote:
i know, idid try it again and it works as expected. but how the h***
did it not work that one time?
--
http://mail.python.org/mailman/listinfo/python-list
Jul 8 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2985
by: Alex Shi | last post by:
Hi all, Please take a look at following very simple script; #!/usr/bin/php -q <? echo "Hello, world!\n"; if (!$tty) { $tty = fopen('php://stdin', 'r'); }
8
1455
by: Alan Little | last post by:
I started with the following code in an included file: $CompanyBlock = "$Company (Booth#: $Booth)\n". "$Address\n". "$City, $State $PostalCode\n". "$Website\n". "$Contact1, $Title1\n". "Tel: $Phone\n". "Fax: $Fax\n".
1
1058
by: petdoc | last post by:
Hi Folks, I am trying to find the most perplexing bug I have had in a vb.net app to date. Here is some code: Dim Data as Short Data = Me.ReadPMAPDigits(pmOffsets.APIAS)
9
1292
by: ZorpiedoMan | last post by:
This is so weird, and I cannot even isolate the cause enough to give any clues as to how to reproduce the error, so this is probably a real shot in the dark... BUT, has anyone ever run into a situation where pressing the enter key on a textbox control is NOT captured by the KeyPress event? Now before you ask: -- The form does NOT have a default button selected.
9
1393
by: Elliot Rodriguez | last post by:
WinXP Pro Let me preface this by saying I have developed with the .NET IDE since its release, and I consider myself reasonably savvy with it. I have a medium sized form with about 120 controls - 60 labels and the rest are DropDownLists and TextBoxes. Almost every TextBox or DropDownList is placed in a Panel control whos visibility property is changed based on postbacks from another DropDownList (basically its a form that builds up...
5
1715
by: Pupeno | last post by:
Hello, I am experiencing a weird behavior that is driving me crazy. I have module called Sensors containing, among other things: class Manager: def getStatus(self): print "getStatus(self=%s)" % self return {"a": "b", "c": "d"} and then I have another module called SensorSingleton that emulates the
9
2056
by: fabio.bizzetti | last post by:
Hello all, I went across what seems possibly a bug of the compiler (VisualC 2005, just for the record) or a very strange and non-expected (by me at least) behaviour of the C++ ISO standard. Thus I'm posting on both newsgroups. Here we go: I noticed that if I nest a structure inside another one, the wrong constructor will be called.. the one from a different class!! Here is some test code:
112
4762
by: Prisoner at War | last post by:
Friends, your opinions and advice, please: I have a very simple JavaScript image-swap which works on my end but when uploaded to my host at http://buildit.sitesell.com/sunnyside.html does not work. To rule out all possible factors, I made up a dummy page for an index.html to upload, along the lines of <html><head><title></title></ head><body></body></html>.; the image-swap itself is your basic <img src="blah.png"...
4
1483
by: jlhsgcib | last post by:
Hello, I have the following snippet of code: sub getPasswordStatus { my ($login, $password) = @_; my$quotedLogin = quotemeta($login);
1
2042
antonopn
by: antonopn | last post by:
Hello there, I have just faced a really weird problem with a query in SQL SERVER 2000. I had a database with collation SQL_Latin1_General_CP1_CI_AS and converted it in a new database with collation Greek_CI_AI. The conversion was absolutelly correct. Tables, views, sps, functions etc. where succesfully transfered into the new database. The new database is working fine, but I faced a problem with a "select-from-where-like" query. I...
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9525
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10452
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10221
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10169
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9050
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.