Hacker News new | past | comments | ask | show | jobs | submit login

> You can require additional brackets around assignment if you use the returning value (or otherwise it's syntax error). They did that with the new one anyway.

They only did it if the := is at the root level. The following is completely legal:

    if match := re.search(pat, text):
        `print("Found:", match.group(0))
or

    [y := f(x), y**2, y**3]



Great, I haven't used := thing yet. I think it's more elegant like that.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: