From b147a1c4902ecd05a73a4d27eb34661525e12633 Mon Sep 17 00:00:00 2001 From: Estevan Pequeno Date: Fri, 30 Dec 2011 11:02:43 -0600 Subject: [PATCH 1/2] Update docs/writing/style.rst --- docs/writing/style.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/writing/style.rst b/docs/writing/style.rst index 216c780..e0cf87d 100644 --- a/docs/writing/style.rst +++ b/docs/writing/style.rst @@ -7,6 +7,12 @@ Idioms Idiomatic Python code is often referred to as being *pythonic*. +A common idiom for creating strings is to use `join `_ on an empty string.:: + + letters = ['s', 'p', 'a', 'm'] + word = ''.join(letters) + +This will set the value of the variable *word* to 'spam'. This idiom can be applied to lists and tuples. Zen of Python ------------- From d3dbd65547bc351c2ad1d62d1973b1e4c5e9f715 Mon Sep 17 00:00:00 2001 From: Estevan Pequeno Date: Fri, 30 Dec 2011 11:38:13 -0600 Subject: [PATCH 2/2] Update docs/writing/style.rst --- docs/writing/style.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/writing/style.rst b/docs/writing/style.rst index e0cf87d..54b4a10 100644 --- a/docs/writing/style.rst +++ b/docs/writing/style.rst @@ -14,6 +14,23 @@ A common idiom for creating strings is to use `join `_ page. + Zen of Python -------------