On 2020-02-02, Stefan Ram <r...@zedat.fu-berlin.de> wrote: > JavaScript has a void operator that maps everything to > undefined. E.g., > > JavaScript console > >|< void( console.log( 2 ) ) >| 2 >|> undefined > > I can easily write a corresponding function in Python. > > main.py > > def void( x ): > pass > > void( ( print( 2 ), print( 3 ))) > > transcript > > 2 > 3 > > . But is an operator or a function like that already > defined in Python or its standard library?
I'm not sure why you'd want to - but "None and foo" is an expression that will return None regardless of the value of "foo". -- https://mail.python.org/mailman/listinfo/python-list