Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualpatrrr

Posted 02 April 2013 - 04:45 AM

Thanks, -1 is making it do what I expected it to do. I guess my point was that the chosen design for the method is error-prone, but apparently it's the same in Ruby (not that Ruby is the all-mighty Reasonable Behavior), but not Python. Hmm.

 

The array returned by this method contains each substring of this string that is terminated by another substring that matches the given expression or is terminated by the end of the string. The substrings in the array are in the order in which they occur in this string. If the expression does not match any part of the input then the resulting array has just one element, namely this string.

 

So in the case of ",".split(","), we have one matching substring, ",". And there are two substrings that are either terminated by a matching substring or end of the string, "" and "". So, something is false here? Or am I understanding it wrong? Where does it say that a substring can't have a length of 0?


#2patrrr

Posted 02 April 2013 - 04:45 AM

Thanks, -1 is making it do what I expected it to do. I guess my point was that the chosen design for the method is error-prone, but apparently it's the same in Ruby (not that Ruby is the all-mighty Reasonable Behavior), but not Python. Hmm.

 

The array returned by this method contains each substring of this string that is terminated by another substring that matches the given expression or is terminated by the end of the string. The substrings in the array are in the order in which they occur in this string. If the expression does not match any part of the input then the resulting array has just one element, namely this string.

 

So in the case of ",".split(","), we have one matching substring, ",". And there are two substrings that are either terminated by a matching substring or end of the string, "" and "". So, something is false here? Or am I understanding it wrong?


#1patrrr

Posted 02 April 2013 - 04:41 AM

Thanks, -1 is making it do what I expected it to do. I guess my point was that the chosen design for the method is error-prone, but apparently it's the same in Ruby (not that Ruby is the all-mighty Reasonable Behavior), but not Python. Hmm.


PARTNERS