473,396 Members | 1,767 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,396 software developers and data experts.

Global Objects...

I have a question..

myGlobalDictionary = dictionary()
class someClass:
def __init__(self):
self.x = 0;
def getValue(self, v)
myGlobalDictionary.getVal(v)
myGlobalDictionary doesn't seem to be visible to my someClass methods.
Why? What should I do?

Aug 16 '06 #1
3 1340
KraftDiner wrote:
myGlobalDictionary doesn't seem to be visible to my someClass methods.
Why? What should I do?
Specify more clearly what is happening, what you wanted it to do, and
why you think it's wrong? You haven't given enough information.

--
Erik Max Francis && ma*@alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
Freedom is never voluntarily given by the oppressor.
-- Dr. Martin Luther King, Jr.
Aug 16 '06 #2
KraftDiner wrote:
I have a question..

myGlobalDictionary = dictionary()
class someClass:
def __init__(self):
self.x = 0;
def getValue(self, v)
myGlobalDictionary.getVal(v)
myGlobalDictionary doesn't seem to be visible to my someClass methods.
Why? What should I do?
Is it an oversight that you forgot the ':' on the getValue definition?
You also forgot to do the return. I say the code should look like:

def getValue(self,v) :
return myGlobalDictionary[v]

I am also confused as to what getVal() does.

Chaz
Aug 16 '06 #3
Dan
KraftDiner wrote:
I have a question..

myGlobalDictionary = dictionary()
class someClass:
def __init__(self):
self.x = 0;
def getValue(self, v)
myGlobalDictionary.getVal(v)
myGlobalDictionary doesn't seem to be visible to my someClass methods.
Why? What should I do?
This works:
>>class dictionary(dict):
.... def getVal(self, key):
.... return self[key]
....
>>myGlobalDictionary = dictionary()

myGlobalDictionary['spam'] = 'eggs'

class someClass:
.... def __init__(self):
.... self.x = 0;
.... def getValue(self, v):
.... return myGlobalDictionary.getVal(v)
....
>>>
mySomeThing = someClass()

print mySomeThing.getValue('spam')
eggs
>>>

--
dedded att verizon dott net
Aug 17 '06 #4

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

Similar topics

2
by: Gianguz | last post by:
I'd like to discuss about the opportunity to have a global objects creator that introduces into a general framework (suited for multithreading) a controlled semantic to manage globals variables...
2
by: Thomas Matthews | last post by:
Hi, I'm getting linking errors when I declare a variable in the global scope, but not inside a function. The declarations are the same (only the names have been changed...). class Book {...
15
by: randyr | last post by:
I am developing an asp.net app based on a previous asp application. in the asp applications global.asa file I had several <object id="id" runat="server" scope="scope" class="comclass"> tags for...
8
by: Vishwanathan Raman | last post by:
Hi I have a declared a static DataSet object SOBJ in Global.asax.I also have a localy defined DataSet LSOBJ in Global.asax which I am storing in Application State.Is there any technical...
23
by: David Colliver | last post by:
Hi, using c#, 1.1 I know that we are not supposed to use global variables etc. in c# I am having a problem, but not sure how to resolve. I did have another post here, but may have over...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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,...

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.