PyMyth: Global variables are evil... WRONG!
rosuav at gmail.com
Tue Nov 12 06:02:42 CET 2013
On Tue, Nov 12, 2013 at 3:46 PM, Rick Johnson
<rantingrickjohnson at gmail.com> wrote:
> But python modules can't be interfaces because interfaces
> should protect internal data, prevent external forces from
> meddling with internal state (EXCEPT via the rules of a
> predefined "contract"), hide dirty details from the caller,
> and have clearly defined access points.
> BUT PYTHON MODULES DON'T FOLLOW THIS DESIGN PATTERN!
> No, Python modules can be poked, prodded, and violated by
> any pervert who can spell the word "import".
And C++ objects can be poked by anyone who can do a pointer cast. And
Java objects by anyone who notices that 'const' checks don't apply to
byte-code. In fact, the only language I can think of that actually
"prevent[s] external forces from meddling with internal state" is
HQ9++, which follows the very best principles of data hiding.
More information about the Python-list