Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. def interval(start, stop =None, step = 1 ):
  2. 'Imitates range() for step >0 '
  3. if stop is None:
  4. start, stop = 0, start #since start is already 0, why isn't stop as well?
  5. print start,stop , step
  6. result = []
  7. i = start
  8. while i< stop:
  9. result.append(i)
  10. i+=step
  11. return result
  12.  
  13. start, stop = 0, start
  14.  
  15. start = 0
  16. stop = start
  17.  
  18. a = 1
  19. a, b = 0, a
  20.  
  21. import dis
  22. dis.dis(compile("a = 1; a, b = 0, a", "<string>", "exec"))
  23.  
  24. 6 LOAD_CONST 1 (0)
  25. 9 LOAD_NAME 0 (a)
  26.  
  27. 13 STORE_NAME 0 (a)
  28. 16 STORE_NAME 1 (b)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement