Skip to content

Commit b147a1c

Browse files
committed
Update docs/writing/style.rst
1 parent 19111aa commit b147a1c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/writing/style.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ Idioms
77

88
Idiomatic Python code is often referred to as being *pythonic*.
99

10+
A common idiom for creating strings is to use `join <http://docs.python.org/library/string.html#string.join>`_ on an empty string.::
11+
12+
letters = ['s', 'p', 'a', 'm']
13+
word = ''.join(letters)
14+
15+
This will set the value of the variable *word* to 'spam'. This idiom can be applied to lists and tuples.
1016

1117
Zen of Python
1218
-------------

0 commit comments

Comments
 (0)