Forum: Poser Python Scripting


Subject: Python Request: Bulging for Props

ScottA opened this issue on Feb 25, 2001 ยท 39 posts


jcarp posted Wed, 28 February 2001 at 12:46 PM

Off-Topic Style Notes and Grief-Saving Tips for jbrugion: >>try: >>geom = actor.Geometry() >>except: >># do anything so we don't have a syntax error... >>x = 1 ... "pass" is Python for "do nothing." It's easier to comprehend than a (supposedly) harmless assignment (x = 1) and explanatory comment. Using it might also save hours of unproductive weeping and cursing when 'x' turns out not to be quite as unused as you thought or when some reckless person (possibly me) modifies your script to introduce a 'new' variable they call 'x' and now wonders why it keeps getting set to 1 under such MYSTERIOUS circumstances. At the same time, specifying the exception type you expect (especially when you're going to tolerate it and aren't absolutely certain that the tried code can only throw one type of exception) makes the code more expressive and much less likely to baffle you when it throws something unexpected and intolerable. In this case, as well, I'm pretty sure you'd find out in testing (if not in coding) that a syntax error is not the exception you should really expect. (I'm ignorant regards the Geometry() method or I wouldn't express any doubt.) Left as a comment, it'll just sit there confusing the innocent. Reminding You: "Presentation is Everything," -Jud.