+ 6
The "phythonic way": Is there a proper way of coding in python?
I've been checking some of the python codes in sololearn and I realized that some of them are coded in a much simpler pattern compared to mine. I haven't finished the python course so I did some research and found out about the term "pythonic way." Does anyone have any basic tips for beginners on making their code become more "pythonic"? Is it also necessary to be "pythonic" if you can at least solve the problem in your own way? Man, typing "pythonic" makes me thirsty for some reason.
6 odpowiedzi
+ 4
a good answer here
https://stackoverflow.com/q/25011078
+ 3
Python have a lot of way to do anything. So when people see some python code that seems to attached to Conventional programming thinking (Standard Imperative Programming or objects oriented Programming ) they say is not pythonic.
Remember even we have a lot o ways to get result in python the ways of do it work different and have different performance.
Take the best answer of the post below as example:
https://stackoverflow.com/questions/39045396/where-does-the-performance-boost-of-map-or-list-comprehension-implementations-ov
+ 2
Yes! There is an official standard for Python code to make it Pythonic! Look up "PEP 8" on Google.
+ 1
Anya Is it common practice to make your code "pythonic"?
Is it encouraged in the IT industry for example?
+ 1
Yes. just see David Ashton post. Will complement very well.
+ 1
Interesting, so it's like a coding style that python encourages from its coders