anomaly

boB Stepp robertvstepp at gmail.com
Mon May 11 08:43:33 EDT 2015


On Mon, May 11, 2015 at 2:44 AM, Chris Angelico <rosuav at gmail.com> wrote:
> 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.

Thanks, Chris, that helps a lot. It seems that beyond being a
programming language, Python has a well-established culture that
suggests how the language should be used. I am gathering that
understanding the language and embracing the existing culture are
needed to use Python in the way it is meant to be used, though the
language design allows *other* ways, too.

> Hakuna matata, what a wonderful phrase.

Indeed! And a good way to start my Monday morning.


-- 
boB



More information about the Python-list mailing list