code_junkie

Are there any good reasons why I should not use Python?

Nov 13th, 2011
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. print x # does one thing
  2. print x, # does another
  3.  
  4. x = "hello everybody"
  5. s = x.split(" ") # does what you would expect
  6. y = s.join(" ") # does NOT do what you would expect
  7.  
  8. import re
  9. x = "The sky is red"
  10. r = re.compile("red")
  11. x.sub(r, "blue") # oops, that causes an error
  12. r.sub(x, "blue") # there, that should do it
  13. print x # prints "The sky is red" -- what!?
  14. y = r.sub(x, "blue") # maybe that will do it
  15. print y # nope, now it just prints "blue"
  16.  
  17. referrer = "http://foobar.com"
  18. if override():
  19. referer = "overridden"
  20. print "Referrer: " + referrer
  21. # Do you see the bug?
  22. # There was a typo in a variable name.
  23. # No warning. No error.
  24. # Because you can't enforce variable predeclaration.
  25.  
  26. int x = 0;
  27.  
  28. x = 0
  29.  
  30. def dog ():
  31. falkdfjlkdfj
  32.  
  33. print "Hello Worldn"
  34. dog()
  35.  
  36. time.sleep = 4
  37.  
  38. time.sleep(4)
  39.  
  40. try:
  41. prase(getUserInput())
  42. except:
  43. print 'You entered an invalid number.'
Add Comment
Please, Sign In to add comment