Guest User

Untitled

a guest
Jun 2nd, 2012
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. (List() # Create a new instance of moka.List
  2. .extend(range(1,20)) # Insert the numbers from 1 to 20
  3. .keep(lambda x: x > 5) # Keep only the numbers bigger than 5
  4. .rem(operator.gt, 7) # Remove the numbers bigger than 7 using partial application
  5. .rem(eq=6) # Remove the number 6 using the 'operator shortcut'
  6. .map(str) # Call str on each numbers (Creating a list of string)
  7. .invoke('zfill', 3) # Call zfill(x, 3) on each string (Filling some 0 on the left)
  8. .insert(0, 'I am') # Insert the string 'I am' at the head of the list
  9. .join(' ')) # Joining every string of the list and separate them with a space.
  10.  
  11. # 'I am 007'
Advertisement
Add Comment
Please, Sign In to add comment