Re: Lambda binding solved?

Steven D. Majewski (sdm7g@elvis.med.virginia.edu)
Wed, 2 Mar 1994 12:55:54 -0500

On Mar 2, 1:36, Tim Peters wrote:
>
> > ...
> > How many namespaces are in your $PATH or $PYTHONPATH shell variable ?
>
> Way too many (of course), but PATH is a lousy design for name management!
> PATH=p1:p2:p3 is very much like doing
>
> from p3 import *
> from p2 import *
> from p1 import *
>
> in Python, and prone to all the same unintended & silent name-collision
> errors. How many hours have you spent tracking down "mysterious
> failures" due to some newbie not knowing that (e.g.) /usr/local/bin was
> supposed to come before /usr/ucb in their PATH else they'll get "the
> wrong" version of (e.g.) zcat? But then I never use "import *" except
> for interactive one-shots.
>

Actually, my resolve routine is more like doing:
( except that this doesn't include class/instance variables )

try:
from p1 import symb
except whatever_exception:
pass
try:
from p2 import symb
except whatever_exception:
pass
try:
from p3 import symb
except whatever_exception:
pass

Or else reverse the order - do it backwards - and next the other
imports in except statements.

And so it was an effort to make the above shorter and easier WITHOUT
resorting to the solution ( import p1; import p2; .. ) and problems
you indicate above.

You are right to compare the ordering in TIME of
"import p1; import p2, import p3"
to the ordering in space of a PATH=P1:P2:P3.

Exceptions are another instance where you want the inner-most/
most recent definition. ( And usually they are ordered "in space"
in a stack or a linked list. ). I don't think it is THAT unusual to
want the most recent or the least global instance.

( NOT argueing for nested scopes here: I'm saying it's not unusual,
but it's not the MOST COMMON instance. )

I could go on, but I'm snowed in at home, and I'm having phone/modem
problems, so I'ld better save & quit.

- Steve Majewski (804-982-0831) <sdm7g@Virginia.EDU>
- UVA Department of Molecular Physiology and Biological Physics