How to return a simple variable from a function (still newbie) ?

Stef Mientki S.Mientki-nospam at mailbox.kun.nl
Thu Dec 28 10:14:51 EST 2006


I want to return a "simple" variable from a function,
not using the function result.
Is that in any way possible ??

The code below is from O'Reilly, "Learning Python",
and there seems no way
to return a simple var like "z" in the example below.
Is that true ?

thanks,
Stef Mientki

<Python>
def some_function (z, y):
   z = 2
   y[2] = 'global ?'


x = 5
y = [1,2,3,4]
print x,y
some_function(x,y)
print x,y
</Python>



More information about the Python-list mailing list