Why does python not have a mechanism for data hiding?

BJörn Lindqvist bjourne at gmail.com
Sat Jun 7 16:56:16 CEST 2008


On Wed, Jun 4, 2008 at 2:02 PM, Antoon Pardon <apardon at forel.vub.ac.be> wrote:
> Now of course noone would defend such a limitation on the grounds
> that one doesn't need the general case and that the general case
> will only save you some vertical space.
>
> But when it came to the ternary operator that was exactly the
> argument used, to defend the lack of it.

As far as I remember, the primary motivation was developers experience
with the ternary operator in other languages, especially C, where it
was found to hurt readability. At least in my experience, it is much
much more common to see the ternary operator making code more
obfuscated than easing readability. Time will tell if Python's if-else
expression will be abused in the same way.


-- 
mvh Björn



More information about the Python-list mailing list