Is crawling the stack "bad"? Why?

Steve Holden steve at holdenweb.com
Tue Feb 26 03:26:42 EST 2008


Russell Warren wrote:
> Thanks Ian... I didn't know about threading.local before but have been
> experimenting and it will likely come in quite handy in the future.
> For this particular case it does basically seem like a replacement for
> the threadID indexed dictionary, though.  ie: I'll still need to set
> up the RpcContainer, custom request handler, and custom server in
> order to get the info handed around properly.  I will likely go with
> this approach since it lets me customize other aspects at the same
> time, but for client IP determination alone I still half think that
> the stack crawler is cleaner.
> 
> No convincing argument yet on why crawling the stack is considered
> bad?  I kind of hoped to come out of this with a convincing argument
> that would stick with me...
> 
OK, if you crawl the stack I will seek you out and hit you with a big 
stick. Does that affect your decision-making?

Seriously, crawling the stack introduces the potential for disaster in 
your program, since there is no guarantee that the calling code will 
provide the same environment i future released. So at best you tie your 
solution to a particular version of a particular implementation of Python.

You might as well not bother passing arguments to functions at all, 
since the functions could always crawl the stack for the arguments they 
need.A major problem with this is that it constrains the caller to use 
particular names for particular function arguments.

What happens if two different functions need arguments of the same name? 
Seriously, forget this craziness.

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list