Very pythoninc!<br><br><div><span class="gmail_quote">On 10/1/07, <b class="gmail_sendername">John Machin</b> <<a href="mailto:sjmachin@lexicon.net">sjmachin@lexicon.net</a>> wrote:</span><blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
On Oct 2, 6:27 am, brad <<a href="mailto:byte8b...@gmail.com">byte8b...@gmail.com</a>> wrote:<br>> Is this the correct way to slice the last 4 items from a list?<br>><br>> x = [1,2,3,4,5,6,7,8,9]<br>> print x[-4:]
<br>><br>> It works, but is it Pythonic?<br><br>It's Pythonic. It's also unambiguous, unlike your specification, which<br>could be interpreted as 'chop off the last 4 items from a list' i.e.<br>del x[-4:]. What you are actually doing is 'print the last 4 items of
<br>a list'.<br><br>--<br><a href="http://mail.python.org/mailman">http://mail.python.org/mailman</a>/listinfo/python-list<br></blockquote></div><br><br clear="all"><br>-- <br><a href="http://search.goldwatches.com/search.aspx?Search=cufflinks">
http://search.goldwatches.com/search.aspx?Search=cufflinks</a> <br><a href="http://www.jewelerslounge.com">http://www.jewelerslounge.com</a>