[Tutor] Code evaluation inside of string fails with __get_item

Tim Johnson tim at johnsons-web.com
Sun Dec 12 20:42:49 CET 2010


* Steven D'Aprano <steve at pearwood.info> [101211 17:20]:
> Tim Johnson wrote:
>
>>   I've never had the occasion to use assert() or any other
>>   python - shooting tools, any thoughts on that?
>
>
> Assertions are a great tool, but never ever, under pain of great pain,  
> use assert for testing user input or function arguments.
<.....>
>
> Who makes that choice? You, or the caller? If the caller, then any  
> errors that occur are not internal state, and you shouldn't use assert.  
> If you, then it's an internal detail and you can use assert.

  Steven: Thanks very much for taking so much time and effort to
  answer my question. I will file this writing for future and
  ongoing reference. 

  BTW: I was able to solve the problem. Essentially a clone of
  Eval() was being called and probably clobbering the stack frame.
  It was a tedious process of tracking thru known and likely code
  dependencies and insert debugging stubs. I've written my own
  debugging macros using vimscript and from your input I would guess
  that assert would have just clouded the process.

  thanks again.
-- 
Tim 
tim at johnsons-web.com or akwebsoft.com
http://www.akwebsoft.com


More information about the Tutor mailing list