Is PEP-8 a Code or More of a Guideline?

Warren Stringer warren at muse.com
Thu May 31 17:00:00 EDT 2007


Wildemar Wildenburger wrote:
> This may be a nice
> idea for the Next Overwhelming Programming Escapade (Codename: NOPE) 
> ...
> You may want to elaborate on the "new way to think about names". Maybe
> you have a point which I just don't see.

Is it considered pythonic to LOL?

Nietzsche would love NOPE ... and so would his psychiatrist.
Nope, I'm proposing: "Yo! Extend that Python" (Codename: YEP) 

I'm treating classes as nested dictionaries. Not *all* classes; only the
ones that I want to use and code from a cell phone. 

I've been porting a scripting language, that was written in C++ to Python.
It allows declare a structure like this: 
    
    mouse
        position x,y
        button
            left x,y
            right x,y

and pipe the whole tree to a recorder, like this:

    record << mouse//

which is like doing this: 

    record << [mouse.position.x,
               mouse.position.y, 
               mouse.button.left.x,               
               mouse.button.left.y,
               mouse.button.right.y,
               mouse.button.right.y]

So, how is this related to the addinfourl example? It isn't. At least, not
for rewriting old API. But for fresh APIs, add.info.url() forces you to
think about names, and functionality in a fine grained way. This translates
roughly to:

    class add(object)...
        class info(object)...
            class url(object)...

or as a dict:

    {'add' : { 'info': 'url' { ...

Then it becomes easier to think about decorators, generators, and closures
in a way that is quite amorphous. (Though slow?)

Tschüs,

\~/





More information about the Python-list mailing list