the annoying, verbose self

Colin J. Williams cjw at sympatico.ca
Sun Nov 25 10:47:48 EST 2007


MonkeeSage wrote:
> The issue of lexical scope still looms large on the horizon. How does
> one distinguish between attributes (as scoped by the "with" clause),
> local/global variables, and function/method calls? There doesn't seem
> to be an easy way. You'd need multiple passes over the data to
> determine various scopes -- and for what, to save typing a few
> characters? And even if implemented, it would mean hiding the
> complexity of the resolution, which is not a good thing.
> 
> Regards,
> Jordan

Does this address your concerns?

The idea being that "with self" use
creates a new namespace:
    newGlobal= oldGlobal + oldLocal
    newLocal= names from self

Similarly, "with math" creates a newer
namespace:
    newerGlobal= newGlobal + newLocal
    newerLocal= names from math

My guess is that there would be little
use for nesting the
"with".


Colin W.



More information about the Python-list mailing list