RE: [PyCrust] Thoughts...
Brought to you by:
pobrien
From: Patrick K. O'B. <po...@or...> - 2001-08-12 16:24:44
|
This has been checked in to CVS. Here is an example with the new parameter: locals = {'__app__': 'PyCrust Application'} self.shell = Shell(editorParent=self, introText=intro, locals=locals) The implementation inside the Shell class looks like this: self.locals = {'__name__': 'PyCrust', '__doc__': 'PyCrust, The Python Shell.', '__version__': version, } # Add the dictionary that was passed in. if locals: self.locals.update(locals) As you can see, there is the potential for the passed in locals to replace the dictionary values that I am setting in self.locals. Whenever I am faced with the opportunity to allow a caller to override something, I almost always allow it. I'm assuming that users of PyCrust want more control, not less, even if it allows them to shoot themselves in the foot. I should probably add a check to make sure that locals is a dictionary. I'm still coming to terms with the right level of type checking in Python. Anyone feel strongly about this? Is it necessary? Not necessary? Depends? --- Patrick K. O'Brien Orbtech "I am, therefore I think." -----Original Message----- From: pyc...@li... [mailto:pyc...@li...]On Behalf Of Patrick K. O'Brien Sent: Sunday, August 12, 2001 8:43 AM To: pyc...@li... Subject: RE: [PyCrust] Thoughts... That makes sense. I'll add it to the TODO list. --- Patrick K. O'Brien Orbtech "I am, therefore I think." -----Original Message----- From: pyc...@li... [mailto:pyc...@li...]On Behalf Of Robin Dunn Sent: Friday, August 10, 2001 6:55 PM To: pyc...@li... Subject: [PyCrust] Thoughts... 1. It would be nice if Shell.__init__ could accept a dict for the locals, which could then be augmented with the locals you already provide if you like. _______________________________________________ PyCrust-users mailing list PyC...@li... http://lists.sourceforge.net/lists/listinfo/pycrust-users |