RE: [PyCrust] CallTips and AutoComp need work
Brought to you by:
pobrien
From: Patrick K. O'B. <po...@or...> - 2001-08-08 18:26:07
|
The shell editor contains text and nothing else. I can't do anything introspective with that text until I turn it into an object reference. That means there is no way to get a call tip or auto complete list without doing an eval() on that text. Doing an eval() may have side effects. Or it may simply fail because the text passed to it is not valid syntax or not a known object. At this point, the PyCrust calltip and autocomp do NOT eval() code that contains a method or function call, such as in your third example below. So it won't pop up a call tip or autocomp on those. However, in your third example, it does try to eval('.getText') and that fails, as you might expect. But the eval() is in a try: block so the program goes on without a hitch. The result that you are seeing is that this failure inside the try: block writes an error message to the dos window and I'm pretty sure that has to do with where the current functions are located and I am working on restructuring that code. The other issue, to me, is, wouldn't it be nice to be able to get an autocomplete list on simple code like "dir()." and so forth? Even your third example doesn't have a serious side effect. --- Patrick K. O'Brien Orbtech "I am, therefore I think." -----Original Message----- From: pyc...@li... [mailto:pyc...@li...]On Behalf Of Kevin Altis Sent: Wednesday, August 08, 2001 12:47 PM To: pyc...@li... Subject: RE: [PyCrust] CallTips and AutoComp need work I don't see how you could know whether a method has side-effects or not. I reiterate what I said originally, which is that if you can't get a doc string without doing an eval on the code, then you shouldn't try. That means stuff like this in PythonCard: bg = pcapp.getCurrentBackground() # can return a doc string fld1 = bg.find('field1') # can return a doc string bg.find('field1).getText() # can't return a doc string for getText Does that make sense? |