sounds promising...
i'll give it a try and see if it all works well !

On 10/5/06, Updike, Clark <> wrote:
You could create a subclass of PyStringMap that you
supply to PythonInterpreter for the locals dictionary.
Your subclass could put special handling for __setitem__
that detects rebinding of a class reference--or of
"reserved" items that shouldn't be rebound.  That said,
I've never tried it and there could be some good
reasons not to do this that I'm not aware of.  I
have seen this strategy mentioned before on the list though.



        From: On Behalf Of Ruchir Talwar
        Sent: Thursday, October 05, 2006 10:44 AM
        Subject: [Jython-dev] Hi

> Hi,
> Im an avid Jython developer and have been following
> this dev list for some time.  I have a question
> about Jython which has bothered me for some
> time and I don't know who to ask. It does not belong
> to the users list because I know it is not possible
> at the moment.
> class A(object): pass
> A=A()                        # Ive lost class A
> b=A()
> Traceback (innermost last):
>   File "<console>", line 1, in ?
> TypeError: call of non-function ('__main__.A' object)
> How do I protect 'A' ?
> Can we not provide a hook when binding a variable
> to an object in the locals(), globals()
> something like __localbind__(), __globalbind__()
> I saw some post somewhere which said it is not
> possible in Python and that it really isn't
> something to be concerned about?
> Im currently developing a framework in Jython
> using PyServlet to load different web servlets.
> In those servlets I want to be able to make
> available certain of my own datatypes
> e.g. MO (money), LD (Large decimal) etc
> The problem is that these types can be easily
> overwritten in the current namespace.
> I don't think this is a small issue and im definitely
> concerned about failing servlets etc. because a
> programmer has typed it wrong!
> I would like to propose that a hook be given to the
> programmer so that this is not overwritten.
> Im sorry if this question does not belong here.
> Please bear with me and do tell me where i should
> post it if not here?
> Thanks
> Ruchir