Steven, thanks for your help once again :)

so you could write the code like:

test = 'first'
class aclass:
     def __init__(self, value):
         mod = __import__(__name__)
         mod.test = value

This is sweet. I really like this technique for manipulating module-scope identifiers (from within a class or function).


To the OP:

In general, this seems like a bad organization strategy for your code. What is your actual use case?

Agreed. It is an interesting intellectual exercise, but there is surely a better way of controlling access to 'test' in the OP's post.


thx
Caleb
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to