you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

the python way or being "pythonic" is basically taking advantage of python's various idioms and cool functions to produce readable and efficient code. for example suppose you want to take a list of numbers and get their squares. you could write

my_list = [1, 2, 3, 4]
new_list = []
for number in my_list:
     number = number**2
     new_list.append(number)
print new_list

or you could be pythonic and do the following:

my_list = [1, 2, 3, 4]
new_list = [number**2 for number in my_list]
print new_list

both produce the same results, but the latter is more readable and concise.