WG: [Zope] call by reference

Arenz, Ralph Ralph.Arenz@friatec.de
Fri, 23 Feb 2001 17:08:40 +0100


-----Urspr=FCngliche Nachricht-----
Von: Arenz, Ralph=20
Gesendet: Freitag, 23. Februar 2001 16:24
An: 'Daniel Rusch'
Betreff: AW: [Zope] call by reference


They are non object related methods and in the same file.
I think i found a way to solve the problem.=20
Do I have to work with the 'global' statement , like this ?


e.g:

modul_foo:

      def foo2():
         x,y=3D2,3
         foo(x,y)

	def foo(foo1,foo2):
         global x,y
         x=3Dfoo1+1
         y=3Dfoo2+1

Result in foo2:  x=3D3 , y=3D4 ?

ralph

-----Urspr=FCngliche Nachricht-----
Von: Daniel Rusch [mailto:drusch@globalcrossing.com]
Gesendet: Freitag, 23. Februar 2001 16:18
An: Arenz, Ralph
Betreff: Re: [Zope] call by reference


Are foo() and foo2() in the same file? Are they members of the same
object or are they non object related methods?

Dan

"Arenz, Ralph" wrote:
>=20
> Hi,
>=20
> for some external methods in zope i have do
> write some python scripts.
>=20
> Here my question:
> I want do a 'function - call by reference' in python.
>=20
> My function definition is like that:
>=20
>  def foo(foo1,foo2):
>        foo1=3D1
>        foo2=3D2
>=20
> My intention is to call the function from an other function
> in the python script like
>=20
>  def foo2():
>       x,y=3D2,3
>       foo(x,y)
>=20
> I know that python is working with seperate namespaces
> in case of function calls, but is there a work-around for
> this problem.
>=20
> ralph
>=20
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )