On Mon, Feb 11, 2013 at 11:53 PM, Rick Johnson
<rantingrickjohn...@gmail.com> 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!

So...

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.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to