Skip to content

Commit 0e989d7

Browse files
author
lambdadi
committed
Suggest improved introduction to Style/#Idioms
My reading, though limited, suggests that the general notion of Idioms is used often, but rarely explained. It feels very alien to beginners. A term like "Idiomatic Python" can cause mental stack overflow. It did to me :) So I humbly submit, in this case, explicit is better than implicit. I debated whether to place it at the top of the document, where idioms are first mentioned, but placed it here instead, as this section explicitly references the topic of idioms.
1 parent e28c3a5 commit 0e989d7

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

docs/writing/style.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,16 @@ is a probable indication that such a refactoring is needed.
251251
Idioms
252252
------
253253

254-
Idiomatic Python code is often referred to as being *Pythonic*.
254+
A programming Idiom, put simply, is _a way_ to write code. The notion of programming Idioms
255+
is discussed amply at `c2 <http://c2.com/cgi/wiki?ProgrammingIdiom>` and at `Stack Overflow <http://stackoverflow.com/questions/302459/what-is-a-programming-idiom>`.
256+
257+
Idiomatic Python code is often referred to as being *Pythonic*.
258+
259+
Although there usually is one-- and preferably only one --obvious way to do it;
260+
_the_ way to write idiomatic Python code can be non-obvious to Python beginners. So,
261+
good idioms must be consciously acquired.
262+
263+
Some common Python idioms follow:
255264

256265
.. _unpacking-ref:
257266

0 commit comments

Comments
 (0)