[Baypiggies] Idiotmatic Savanica

Warren Stringer warren at muse.com
Tue May 15 21:57:41 CEST 2007


>> I use double underscores for __setInChild__ and  __ok_attrs__ ... 

> Looks like you're trying to take advantage of a weird special feature
of your IDE and thereby violating Python conventions (_in theory_ the
whole set of names starting and ending with two underscores is
reserved to the Python ... 

Ok, I got rid of the double underscores - did so by, creating my own
SUB-legion -- let's call it a platoon -- with a single leading underscore
for member names, like so: www.muse.com/tr3/tr3_platoon.py   

So, instead of putting each member into a list, as previously done:

	_ok_attrs = set('who what child parent'.split())
	...
	if name in self._ok_attrs: 
		...

Now it simply tests for leading underscore 

	if name[:1] == '_': 
			...

>> I like encapsulating any redundancy into a def - which is another form 
of documentation. So, took your suggestion about adding a _setInChild(name).


> Better!

Usually Better is best. But, I've spent some time thinking about
_setInChild(name) and its callers. If we were to look at their entropy by
replacing nouns with single letters, and verbs with single symbols, then the
inline and called versions would look like this:

_______________________________

g(n)
    ? d.n
        ^d.n
    ? !c.n  			#inline
        c.n = t.n 		
    ^c.n

s(n,v)
    ? k.n
        s.n = v  
    :   
        ? !c.n			#inline
            c.n = t.n 
        c.n.w = v

_______________________________

i(n)
    ? !c.n 
        c.n = t.n
g(n) 
    ? d.n  
        ^d.n
    i(n)  				#called
    ^c.n
    
s(n,v)
    ? k.n
        s.n = v 
    :   
        i(n) 			#called
        c.n.w = v

_______________________________

Further replacing INDENT NEWLINE DEDENT with / | \  
reduces both to roughly the same size:

g(n)/?d.n/^d.n\?!c.n/c.n=t.n\^c.n\s(n,v)/?k.n/s.n=v\:/?!c.n/c.n=t.n\c.n.w=v\
\
i(n)/?!c.n/c.n=t.n\\g(n)/?d.n/^d.n\i(n)|^c.n\s(n,v)/?k.n/s.n=v\:/i(n)|c.n.w=
v\\

Does this mean they're the same? Perhaps for a machine! I'm too lazy to do
any predictive compression to know for sure. Am more concerned about Human
coders. For us, this is a wetware decompression problem.

Regard the noun sets for each version of inline and called:

	inline:  { g:[n,d,c,t], s:[n,v,k,s,c,t,w] }
	called:  { g:[n,d,i,c], s:[n,v,k,s,i,c,w], i:[n,c,t] }

Sooo, I'd say that the called version has more conceptual overhead. 

Moreover, for the called version, the eye must shift focus to find i
somewhere else on screen, which results in, at least, a 200 millisecond
saccade, where a human doesn't see anything. Furthermore, if you must scroll
to find i, then add a few more seconds to the seek time.

So, _setInChild(name) is gone. 

\~/

Legionnaire's quote for the day:  
ARTHUR: "Run away! Run away!"




More information about the Baypiggies mailing list