How to do * and & C-lang. operations in Python?

Toni Gaya gaya at infomail.lacaixa.es
Thu Sep 20 12:46:58 EDT 2001


I have a variable defined on one module, and want to use _exactly_ the
same variable in other module. Example:

module1:
	a = 1

module 2:
	import module1
	a = module1.a
	Now, I have module1.a value in a, not a reference to module1.a in a
(module2.a).
Assignaments are done by 'value', not by 'reference'. Function calls
are done by 'reference'. How to do assignaments by reference?. In C
language, I can do:
c = &d
*c = 3
and now, c and d values are 3. (two pointers that point to same value
place)

---------------------

Another question:

module1:
	import module2

module2:
	If I do: "python module1", How to call a function from module1, from
here (module2)?


Thank you.



More information about the Python-list mailing list