Flat is better than nested?

The above dictum is part of the "Zen of Python."

It is also a load of hooey.

If Python users really believed this... they wouldn't be working in Python. They'd be working in C. Or better yet, assembler. Because Python already "nests" those two languages. And they wouldn't be using all the many Python libraries: yet more nesting!

The right statement is: "There is a trade-off between flat and nested, so think about the trade-off carefully."

I have seen this trade-off with my students: sometimes, the fact that they are working at the leaves of a deep inheritance tree confuses them. But it also gives them the ability to easily add features to their programs like:

 Ain't no easy answers!

Comments

Popular posts from this blog

Libertarians, My Libertarians!

"Pre-Galilean" Foolishness