Zen of Python: Difference between revisions

Content deleted Content added
Rescuing 1 sources and tagging 0 as dead.) #IABot (v2.0.9.5
Revert Python code changes and add a footnote on its verbatim quote from the Glossay page
 
(One intermediate revision by one other user not shown)
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>{{efn|This definition below is directly quoted to preserve its definition. So as is, it is not self-contained valid Python to run without errors.}}

<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)):