[Python-ideas] Interrogate alternate namespace keyword and concept

Prozacgod prozacgod at gmail.com
Fri Aug 14 21:46:17 CEST 2009


I just read this inside of the C# reasoning, and this pretty much kinda
says, look its to difficult...

This is a good reason "Another approach is to push a scope and make the
property hide the local variable, but then there's no way to refer to the
local without adding some escape syntax."

bascially, they added the dot syntax to acces variables that are intended to
be directed towards object namespace.  Which I do agree helps with
disambiguation,

foo = 32
interrogate(test_ns):
  print .foo
  print foo

But don't find all that paletable.  My thoughts on this would be to cover
the parent local namespace, and even globals with your object, the object
gets it first everytime, and if it raised an exception, then the normal
method would be implemented.  If it were important to have a variable that
was named the same, then access it outide the interrogate block or
otherwise..  But if you were a developer and working on writing a program,
knowing you wanted to use interrogate, then wouldn't you be wise to choose
different variable names?  I think I would.

Also doing this is kinda kludgy feeling to me..

function(args).dict[index][index].a = 21
function(args).dict[index][index].b = 42
function(args).dict[index][index].c = 63

write this:

ref = function(args).dict[index][index]
ref.a = 21
ref.b = 42
ref.c = 63

even though it is optimised, and works well, this feels more like the
programmer adapting to the environment instead of the environment working
for the programmer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090814/f4bf7992/attachment.html>


More information about the Python-ideas mailing list