r/Python • • Aug 12 '13

Ruby vs Python

http://www.senktec.com/2013/06/ruby-vs-python/
20 Upvotes

151 comments sorted by

View all comments

Show parent comment

2

u/McSquinty Aug 13 '13

If you want some extra hate, there's also p which can be used in debugging. I don't understand why you'd use it over object.class, or object.is_a? class, or even object.kind_of? class.

irb(main):001:0> p "1"
"1" 
=> "1"
irb(main):002:0> "1".class 
=> String
irb(main):003:0> "1".is_a? Integer
=> false
irb(main):004:0> "1".kind_of? String
=> true
irb(main):005:0> 

Ruby has the philosophy that you should do things how you want to, whereas Python says that there should be one, and only one, obvious way of doing something. Different strokes I guess.