Name rebinding

ccg at mudprovider.com ccg at mudprovider.com
Thu Mar 16 13:43:59 EST 2000


 I'm trying to set up an in-game scripting language using python - but the
game itself is also in python.  Is there any way I can prevent the scripts
from being able to rebind non-script variables/functions/methods/classes
while still allowing them access to at least a sub-set of the non-script
code?  Here's a simple example of what I'm talking about:

 class GameInterface:
	# Whatever...

 def someGameFunction(script, gameInterface):
	# ...
	script.execute(gameInterface)
	# ...

 class Script:
	def execute(self, interface):
		# I want this to work:
		interface.someFunction()

		# But not this
		class Badness:
			# Evil malicious code
		
		global GameInterface
		GameInterface = Badness

 Thanks in advance



More information about the Python-list mailing list