From: Ruchir T. <ruc...@gm...> - 2006-10-05 14:43:59
|
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 |