Go Back   CodingForums.com > :: Server side development > Other server side languages/ issues > Python

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-11-2012, 06:00 AM   PM User | #1
SoccerGee
New to the CF scene

 
Join Date: Jan 2012
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
SoccerGee is an unknown quantity at this point
Tutorial Help

I'm going through the Python Tutorial on the python website and needed a little extra explanation of what this code is actually doing. Maybe I'm just missing something obvious?

Code:
>>> for x in a[:]: # make a slice copy of the entire list
...    if len(x) > 6: a.insert(0, x)
...
>>> a
['defenestrate', 'cat', 'window', 'defenestrate']
SoccerGee is offline   Reply With Quote
Old 01-11-2012, 06:11 AM   PM User | #2
SoccerGee
New to the CF scene

 
Join Date: Jan 2012
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
SoccerGee is an unknown quantity at this point
Quote:
Originally Posted by SoccerGee View Post
I'm going through the Python Tutorial on the python website and needed a little extra explanation of what this code is actually doing. Maybe I'm just missing something obvious?

Code:
>>> for x in a[:]: # make a slice copy of the entire list
...    if len(x) > 6: a.insert(0, x)
...
>>> a
['defenestrate', 'cat', 'window', 'defenestrate']
never mind... it's obviously past my bed time.
SoccerGee is offline   Reply With Quote
Reply

Bookmarks

Tags
slice copy

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:25 PM.


Advertisement
Log in to turn off these ads.