473,326 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Re: Someone enlightened me

Duh,

Ok here is the file again ...attached. I give up doing this via the
email editor. Sorry! new to the mailing list.

Marcus

Marcus Low wrote:
Opps here is the mail again, incase my formatting is lost, can someone
explain to me why this code behaves differently when "lister" and
"self.lister" is swap remarked.
class abc :
# remark this later and unremark "self.lister"
lister = []
def __init__ (self, val):
#self.lister = []
self.lister.append(val)
globallist = []

def test () :

global l
for x in range(10) :
o = abc(x) globallist.append(o) o
= ""
for i in globallist :
print i.lister
test()

class abc :
# remark this later and unremark "self.lister"
lister = []
def __init__ (self, val):
#self.lister = []
self.lister.append(val)

globallist = []

def test () :
global l
for x in range(10) :
o = abc(x)
globallist.append(o)
o = ""

for i in globallist :
print i.lister

test()

Jul 13 '08 #1
0 916

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

Similar topics

2
by: Sean | last post by:
I have two sites that i use for personal stuff (family, friends, photos). They are PHP sites butim not a programmer. They were setup by a friend who no longer helps with them. There are some...
3
by: Tony Vasquez | last post by:
I am trying to modify my own web site to have a certain type of dynamic background through divs... and such.... but what I need, is help with this one script I have. I want to modify it to work...
6
by: Don | last post by:
Hi, I have the following script that displays a popup window centered in the middle of the screen. I am getting a script error in both IE and Netscape but I don't know what it means. Thanks in...
14
by: bo | last post by:
And why and where one should use one vs. the other? Verbally, it seems like semantics to me--but obviously there is some actual difference that makes references different and or preferable over...
1
by: Mike | last post by:
Hello, I can't find any javascript that reads and writes cookies with keys, so that it is compatible with ASP (I want to read and write cookies from both javascript and ASP) for example in...
9
by: kaeli | last post by:
Hey guys, I found some code I really like. ;) It has who wrote it there, but no contact info. If I attribute the author, is that enough, or should I also try to contact him for permission to...
9
by: bounce | last post by:
Hello, Consider the following HTML: <form action="/cgi-bin/mailmanager.pl" method="post"> <input type="hidden" name="recipient" value="bounce@springbock.net"> <input type="hidden"...
0
by: Marcus Low | last post by:
Opps here is the mail again, incase my formatting is lost, can someone explain to me why this code behaves differently when "lister" and "self.lister" is swap remarked. class abc : # remark...
0
by: Gary Herron | last post by:
Marcus Low wrote: It's a Python scoping rule: If a variable is assigned to anywhere within a function, it is assumed to be local *everywhere* within that function. See the faq for more: ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.