simultaneous assignment

David Isaac aisaac0 at verizon.net
Tue May 2 13:49:11 EDT 2006


"John Salerno" <johnjsal at NOSPAMgmail.com> wrote in message
news:8dM5g.2031$No6.43874 at news.tufts.edu...
> Is there a way to assign multiple variables to the same value, but so
> that an identity test still evaluates to False?

Make sure the value is not a singleton.
Assign them one at a time.
>>> w=1000
>>> x=1000
>>> w==x
True
>>> w is x
False
>>> w=2
>>> x=2
>>> w==x
True
>>> w is x
True

Hope that helps,
Alan Isaac





More information about the Python-list mailing list