code doesn't work: question

Bo M. Maryniuck b.maryniuk at forbis.lt
Tue Sep 3 06:24:45 EDT 2002


On Tuesday 03 September 2002 12:03, Ruslan Spivak wrote:
> Hello python-list user,
> I want somebody to explain me why next code doesn't work:
>
> var = 5
>
> if (tmp = var) == 5:         # this is the error line
>    print "ok"
> else:
>    print "error"

You probably want other operator than '='. e.g.:

	if (tmp + var) == 5:
		pass

Because the code:

	tmp = var

..is not a logical stuff and returns nothing.

-- 
Regards, Bogdan

"While preceding your entrance with a grenade is a good tactic in
Quake, it can lead to problems if attempted at work." -- C Hacking





More information about the Python-list mailing list