Problem with using PythonWin and ActiveX COM Object
kalab at my-deja.com
kalab at my-deja.com
Fri Oct 6 06:29:40 EDT 2000
In article <8ri8ba02lfe at news1.newsguy.com>,
"Alex Martelli" <aleaxit at yahoo.com> wrote:
> The behaviour of any Python function is just like that of "thebyval":
> after a sequence such as
> a=23
> b=a
> thepythonfunction(a)
it depends if the argument is mutable or not:
def change(a):
a[0] = 24
a=[23]
b=a
print a, b
change(a)
print a, b
Output:
[23] [23]
[24] [24]
> it MUST, always, be the case that a and b are still identical, no
> matter how "thepythonfunction" is written (well... one could play
> dirty tricks to find and alter the caller's namespace, maybe, but
> I wouldn't recommend it!-).
You are right - a and b must always be identical since they are both
references.
Gerhard
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list