LangWart: Method congestion from mutate multiplicty

Chris Angelico rosuav at
Mon Feb 11 14:27:30 CET 2013

On Mon, Feb 11, 2013 at 11:53 PM, Rick Johnson
<rantingrickjohnson at> wrote:
> Which primitive(s) should NOT have been expanded in your opinion? The "Point" object? I agree, that's why MY implementation would call seq.flatten() on all sub-sequences THEREBY allowing each subtype to define it's own flatten behavior. Of course the default behavior of the SequenceBase#flatten would be to flatten everything.
> However, ImmutableSequence Types would not flatten. In your example ["spam", "ham"] would not be expanded to ['s', 'p', 'a', 'm', 'h', 'a', 'm']. psst: strings and tuples are immutable!


flatten([None, 23, [1, 2, 3], (2, 3), ["spam", "ham"]])

would return

[None, 23, 1, 2, 3, (2, 3), "spam", "ham"]

? I think that's even more unexpected.


More information about the Python-list mailing list