Content deleted Content added
Erictleung (talk | contribs) Undid revision 1288135135 by Bsmillstein (talk) although arguably accurate, not part of the official glossary definition |
Erictleung (talk | contribs) →Being Pythonic: Add more direct link to definition |
||
Line 57:
== Being Pythonic ==
One of the principles, "There should be one-- and preferably only one --obvious way to do it", can be referenced as the "Pythonic" way.<ref name=":0" /> The official definition of "Pythonic" is:<ref name=":1">{{Cite web |title=Glossary |url=https://docs.python.org/3/glossary.html#term-Pythonic |access-date=2024-02-07 |website=Python Documentation |language=en}}</ref><blockquote>An idea or piece of code which closely follows the most common idioms of the Python language, rather than implementing code using concepts common to other languages. For example, a common idiom in Python is to loop over all elements of an iterable using a <code>for</code> statement. Many other languages don’t have this type of construct, so people unfamiliar with Python sometimes use a numerical counter instead:
<syntaxhighlight lang="python">
for i in range(len(food)):
|