/top/
/new/
/best/
/ask/
/show/
/job/
^
slacker news
login
about
←back to thread
PEP 572: Python assignment expressions has been accepted
(groups.google.com)
317 points
est
| 1 comments |
03 Jul 18 08:30 UTC
|
HN request time: 0s
|
source
Show context
oooooof
◴[
03 Jul 18 09:00 UTC
]
No.
17448560
[source]
▶
>>17448439 (OP)
#
What is it? The link points to a discussion more deep than I’m willing to read.
replies(10):
>>17448567
#
>>17448570
#
>>17448571
#
>>17448572
#
>>17448575
#
>>17448579
#
>>17448584
#
>>17448591
#
>>17448617
#
>>17448638
#
kibibu
◴[
03 Jul 18 09:06 UTC
]
No.
17448591
[source]
▶
>>17448560
#
High-level overview: it's an assignment operator that returns its value, similar to C's assignment operator.
The choice of := is to avoid accidentally using assignment where comparison is expected.
replies(2):
>>17448770
#
>>17453569
#
1.
bluecalm
◴[
03 Jul 18 20:58 UTC
]
No.
17453569
[source]
▶
>>17448591
#
Yeah but there is already solution for that in C: put parenthesis around assignment when using its value as bool. The compilers warn if you don't so making this error in C can only happen if you don't use warnings.
ID:
GO
↑