Re: [Python-Dev] PEP 572 and assert

2018年7月17日 16:41:13 -0700

On Wed, Jul 18, 2018 at 03:41:08AM +1000, Steven D'Aprano wrote:
> Besides, there is a legitimate use for assignment expressions in 
> assertions:
> 
> assert (spam := something) > 2, 'not enough spam'
> assert sequence[foo] == 999, 'sequence item isn't 999'
Ah, obviously the index in the second line ought to be spam, not foo.
-- 
Steve
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to