From bc7799d1fad0ddc241ee021bd738197b9646d724 Mon Sep 17 00:00:00 2001 From: Kyle Kelley Date: Mon, 18 Mar 2013 18:48:45 -0300 Subject: [PATCH] Separate join and list comprehension --- docs/writing/structure.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/writing/structure.rst b/docs/writing/structure.rst index 0014139..af388bc 100644 --- a/docs/writing/structure.rst +++ b/docs/writing/structure.rst @@ -445,7 +445,8 @@ with calls to append(). .. code-block:: python # create a concatenated string from 0 to 19 (e.g. "012..1819") - print "".join([str(n) for n in range(20)]) + nums = [str(n) for n in range(20)] + print "".join(nums) One final thing to mention about strings is that using join() is not always best. In the instances where you are creating a new string from a pre-determined