Why does python not have a mechanism for data hiding?

Paul Rubin http
Wed Jun 4 07:24:19 EDT 2008


NickC <ncoghlan at gmail.com> writes:
> if/else was added solely because people kept coming up with ways of
> embedding a pseudo conditional inside expressions and writing buggy
> code in the process. All it really saves you in practice is a bit of
> vertical whitespace, so, no, you still don't need it - but if you
> insist on doing it, at least there's now an easy way to do it
> correctly.

Come on, it's more than vertical whitespace, it's extraneous variables
and sometimes even extraneous functions and function call overhead.
And Python is supposed to be unbureaucratic.  People kept looking for
ways to write conditional expressions instead of spewing the logic
across multiple statements for a reason: the code is often cleaner
that way.



More information about the Python-list mailing list