From 0e989d75f39059878001c13bdb027af454d3cbd4 Mon Sep 17 00:00:00 2001 From: lambdadi Date: Wed, 30 Jan 2013 18:23:08 +0530 Subject: [PATCH] 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. --- docs/writing/style.rst | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/writing/style.rst b/docs/writing/style.rst index 919d3a147..41fac9b37 100644 --- a/docs/writing/style.rst +++ b/docs/writing/style.rst @@ -251,7 +251,16 @@ is a probable indication that such a refactoring is needed. Idioms ------ -Idiomatic Python code is often referred to as being *Pythonic*. +A programming Idiom, put simply, is _a way_ to write code. The notion of programming Idioms +is discussed amply at `c2 ` and at `Stack Overflow `. + +Idiomatic Python code is often referred to as being *Pythonic*. + +Although there usually is one-- and preferably only one --obvious way to do it; +_the_ way to write idiomatic Python code can be non-obvious to Python beginners. So, +good idioms must be consciously acquired. + +Some common Python idioms follow: .. _unpacking-ref: