<br><br><div class="gmail_quote">On Thu, Dec 15, 2011 at 1:41 PM, Alexander Heger <span dir="ltr"><<a href="mailto:python@2sn.net">python@2sn.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear Oleg,<br>
<br>
OK, these work for the examples I listed, I had not tried that. Thanks!<br>
<br>
I still think the element extraction would be nice, though.<br>
what does not work your way is<br>
x = [1,2,3]<br>
y = (0,) + x<br>
<br></blockquote><div>The following works</div><div><div>--> x = [1,2,3]</div><div>--> y = (0,) + tuple(x)</div><div>--> y</div><div>(0, 1, 2, 3)</div></div><div><br></div><div>Explicit (i.e. tuple conversion) is better than implicit (The Zen of Python)</div>
<div>André</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
but<br>
y = (0,*x)<br>
could do ... ?<br>
<br>
-Alexander<br>
<br>
On 12/15/2011 11:33 AM, Oleg Broytman wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Thu, Dec 15, 2011 at 10:26:50AM -0600, Alexander Heger wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
x = [1,2,3]<br>
y = [0,*x]<br>
to obtain [0,1,2,3]<br>
</blockquote>
<br>
y = [0] + x<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
or similar for lists<br>
x = (1,2,3)<br>
y = (0,*x)<br>
to obtain (0,1,2,3)<br>
</blockquote>
<br>
y = (0,) + x<br>
<br>
Oleg.<br>
</blockquote>
______________________________<u></u>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/<u></u>mailman/listinfo/python-ideas</a><br>
</blockquote></div><br>