Monday, September 04, 2006

» No builtin flatten in python... +

One view of why there is no built-in flatten in python is that "there are several open semantic questions which are not intuitively answered". But that seems like a cop-out. So what if there are some academic questions about what exactly a flatten method should do? The basic fact of the matter is that people want a method to be able to flatten a multi-dimensional list into a single dimension. Philosophical questions aside, there should be a built-in method to do this. Special cases should be treated as special; let the implementors in those cases create a custom flatten method that will do what they want; edge-cases should never dictate the behavior of the core language. Bottom line is that a flatten method is used often enough to warrent inclusion as a built-in method, even if it doesn't frost the cheerios of every single person who might ever use it.

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home