Pythonic & Non-Pythonic Way In Python
Non-Pythonic :-
# Print The list created using the non-pythonic approach...
Inside the names, whose length more than 5 his name is returned.
This whole process is non-pythonic.
Pythonic :-
# Print the list created by using list comprehension :--
In this list 'lakhan', 'herry', 'arjun', 'kapil' length is greater than or equal to 5
so this name is returned.
This is a pythonic approach.
- The important thing to notice here is that following some of Python's guiding principles allows you to write cleaner and more efficient code.
Remember, Pythonic code == efficient code
Efficient :-
Writing efficient python code
- Minimal completion time ( fast runtime)
- Minimal resource consumption (small memory footprint)
Comments
Post a Comment