|
|
|
|
|
by sri
6223 days ago
|
|
ruby uses < (less than) for inheritance; also regular expressions start & end with / (slash). you have %W, %w for arrays and %q, %Q for string. things like "class << self ..." looks weird to those new to ruby. also stuff like "a ||= ...". and of course pre-pending '@' for instance variables and '@@' for class variables. also when i use regexps in ruby i then say "/re(g)ex/ =~ 'string' && $1". in python that would be multiple statements: "m = re.match('re(g)ex', 'string'); m.group(1)" in python existing syntax (or more familiar syntax) is used to accomplish all the above. |
|
Also, your Ruby vs. Python regex examples aren't even equivalent.