A comma is what generates a tuple. It's not the parenthesis;)<div><br></div><div><a href="http://docs.python.org/library/stdtypes.html#typesseq">http://docs.python.org/library/stdtypes.html#typesseq</a></div><div><br></div>
<div>"<span class="Apple-style-span" style="font-family: -webkit-sans-serif; font-size: 16px; line-height: 20px; ">A single item tuple must have a trailing comma, such as <tt class="docutils literal" style="background-color: rgb(236, 240, 243); padding-top: 0px; padding-right: 1px; padding-bottom: 0px; padding-left: 1px; font-size: 0.95em; "><span class="pre">(d,)</span></tt>."</span><br>
<br><div class="gmail_quote">On Thu, Feb 19, 2009 at 3:57 PM, alex goretoy <span dir="ltr"><<a href="mailto:aleksandr.goretoy@gmail.com">aleksandr.goretoy@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Thank you for clerification Christian,<br>when using trailing comma with print statement/function, does it not mean to output newline after printed data?<br><font color="#888888"><br clear="all">-Alex Goretoy<br><a href="http://www.goretoy.com" target="_blank">http://www.goretoy.com</a></font><div>
<div></div><div class="Wj3C7c"><br>
<br>
<br><br><div class="gmail_quote">On Thu, Feb 19, 2009 at 2:54 PM, Christian Heimes <span dir="ltr"><<a href="mailto:lists@cheimes.de" target="_blank">lists@cheimes.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">

<div>Carl Schumann wrote:<br>
> I could see the logic in always or never having a trailing comma.   What<br>
> I don't understand here is why only the single element case has a<br>
> trailing comma.   Any explanations please?<br>
<br>
</div>Does this code shad some light on the trailing comma? :)<br>
<br>
>>> (1) == 1<br>
True<br>
>>> (1,) == 1<br>
False<br>
>>> type((1))<br>
<type 'int'><br>
>>> type((1,))<br>
<type 'tuple'><br>
<br>
>>> a = 1<br>
>>> a<br>
1<br>
>>> a = (1)<br>
>>> a<br>
1<br>
>>> a = (1,)<br>
>>> a<br>
(1,)<br>
>>> a = 1,<br>
>>> a<br>
(1,)<br>
<div><div></div><div><br>
--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</div></div></blockquote></div><br>
</div></div><br>--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
<br></blockquote></div><br></div>