anomaly

Chris Angelico rosuav at gmail.com
Mon May 11 03:44:31 EDT 2015


On Mon, May 11, 2015 at 5:12 AM, boB Stepp <robertvstepp at gmail.com> wrote:
>> Common Python thought::  "We're all adults here."    If you want to override
>> a builtin within your own namespace, who are we to stop you?
>
> I'm surprised that this thought has not been added to the "Zen Of
> Python", as I see it as more and more recurrent as I continue my
> studies. What I would like to comprehend is what is the essential
> mindset of Python? That is, what do I need to understand, so that I am
> no longer likely to be surprised by discovering new possibilities in
> Python such as what the current thread is discussing?

The Zen of Python is a static document, a historical artifact of a
sort. But in terms of understanding the philosophy of Python, "we're
all adults here" is a big part of it. Once you grok the notion that
nothing can be prevented, you're freed from such considerations as:

* Obfuscating, encrypting, or otherwise hiding your source code
* Private members with restricted access
* Strict type checking, to prevent someone passing in a wrong piece of data
* Prevention of monkey-patching

etc, etc, etc. In actual fact, anyone can bypass any restriction, in
any language; and Python is just more open/honest about it than
languages like C++; for instance, instead of having true private
members where the compiler stops you from looking at or changing them,
Python gives you single-underscore-named attributes, where nobody
stops you from doing anything, but there's a general understanding
that they're not governed by the usual compatibility rules, so
upgrading a library might break your code. Happy with that? Go ahead
then, use the internals.

Hakuna matata, what a wonderful phrase.

ChrisA



More information about the Python-list mailing list