[Zope] global variables in externa Methods

Paul Winkler pw_lists@slinkp.com
Thu, 12 Dec 2002 10:35:51 -0800


On Thu, Dec 12, 2002 at 01:02:20PM +0100, Elena Schulz wrote:
> Hi,
> 
> I want to set globale variables in external methods.
> 
> With the following constuct I get errors if myFunctionA is set as function
> in the add external method form.
> Does anybody know how to set up global vars in external methods.
> 
> -- many thanks for your replies, Elena
> 
> #myExternalModul.py
> 
> def myFunctionA(var1):
> 
>     global var1

Stop right there... that's a syntax error in Python: 
SyntaxError: name 'var1' is local and global

What are you really trying to do?
Why do you pass a parameter to myFuntionA and then
try to make the name of the parameter (which is
local to the function by definition) a global?

--PW

-- 

Paul Winkler
http://www.slinkp.com
"Welcome to Muppet Labs, where the future is made - today!"