This article shows the examples of pythonic in python
replace map, filter by list comprehension
1 | # no pythonic |
replace list comprehension by generator expression
Generator expression takes less memory than list comprehension
1 | # no pythonic |
using of enumerate
1 | # no pythonic |
use with
With the ‘with’ statement, we get better syntax and exception handing
1 | # no pythonic |
use zip
1 | # no pythonic |
exchange two variables
1 | # no pythonic |