DEV Community

Discussion on: Interesting Python Tricks that you should know

Collapse
 
vergeev profile image
Pavel Vergeev

With Pytnon 3.8 getting more widespread, I would also add the := operator.

if unwanted_result := some_action():
    logger.warning('there was some unwanted result! %s', unwanted_result)
    return None
Enter fullscreen mode Exit fullscreen mode