is python Object oriented??
kyrie at uh.cu
Sun Feb 1 20:46:41 EST 2009
On Sunday 01 February 2009 08:00:18 pm Steven D'Aprano wrote:
> On Sun, 01 Feb 2009 12:31:27 -0500, Steve Holden wrote:
> Except of course it isn't. Nobody sensibly complains that they can't
> mangle the length of a list, or move keys around inside dicts, or
> whatever. This data hiding is a good thing.
If lists and dictionaries were not C types, and python didn't have to shield
us from the mess that is C and its pointers, that enforcement may not be such
a good thing. And, while we are at it, that is not python having "selective"
enforcement of data hiding but only for C, that's C/C++ having data hiding
and not exporting the attributes back to python.
> All I want is the ability to do with Python classes what I can do with C
> extension types. I don't think that's an *unreasonable* ask, even if it
> is *unpractical* given the current design of Python.
Well, then. Do you want dynamic checks? Go fix Bastion/rexec (that would be a
_good_ thing, valuable for way more than data hiding). Or do you want static
checks? In that case, you have it already.
Luis Zarrabeitia (aka Kyrie)
Fac. de Matemática y Computación, UH.
More information about the Python-list