Ifs and assignments

Chris Angelico rosuav at gmail.com
Thu Jan 2 23:08:33 EST 2014


On Fri, Jan 3, 2014 at 3:00 PM, Roy Smith <roy at panix.com> wrote:
> I do this all the time:
>
> t0 = time.time()
> [some code]
> t1 = time.time()
> dt = t1 = t0   # <-- spot the typo?

Yep, I see that... now that it's pointed out as a typo. Without the
marker, I'd assume it's correct chained assignment, and only an
examination of the name (dt = delta t) hints otherwise.

ChrisA



More information about the Python-list mailing list