From b147a1c4902ecd05a73a4d27eb34661525e12633 Mon Sep 17 00:00:00 2001 From: Estevan Pequeno Date: Fri, 30 Dec 2011 11:02:43 -0600 Subject: [PATCH] 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 -------------