Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 603 Bytes

silly.md

File metadata and controls

30 lines (21 loc) · 603 Bytes
layout title header group exclude
page
Silly little idioms that should never be used
Silly little idioms that should never be used
navigation
true

Python

Declawing PEP 3113 -- No argument destructuring in python3

ls.sort(key=lambda (value, frequency): -frequency) # Python2

ls.sort(key=lambda x: next(-frequency for value, frequency in [x])) # Python3

This is better than the first level unwrapping

ls.sort(key=lambda x: (lambda value, frequency: frequency)(*x))

Perl like IFs at the end.

{print('My condition is true') for _ in [''] if 1 > 0}