Comparing Python str.split() with str.partition() , I see that they not only have different functions ( split() tokenizes the entire line at each occurrence of the separator, and partition() just returns everything earlier and everything after the first delimitation) , but they also have different types of data returned. That is, str.split() returns a list , and str.partition() returns a tuple . This is important because a list is mutable and a tuple is not. Is there any deliberate reason for this choice in the design of the API, or is it "as it is." I am curious.
source share