Skip to content

AaronLaw/frames.py

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

  __                                             
 / _|_ __ __ _ _ __ ___   ___  ___   _ __  _   _ 
| |_| '__/ _` | '_ ` _ \ / _ \/ __| | '_ \| | | |
|  _| | | (_| | | | | | |  __/\__ \_| |_) | |_| |
|_| |_|  \__,_|_| |_| |_|\___||___(_) .__/ \__, |
                                  |_|       |__/ 

What to do when nothing else helps? Walk the stack trace, of course.

Is it a good idea?   | It depends.
Is it slow?          | Terribly.
Is it cool?          | Fuck yeah!

---------------
I want it, now!
---------------

> pip install frames

--------
But how?
--------

>>> import frames

Seriously?           | Okay, okay.

>>> frames.locate_frame(lambda f: 'BOOM' in f.f_locals)

Boom what?           | Meh...

>>> frames.locate_frame(
...     lambda f: f.locals.get('__name__') == '__main__'
... ).locals['BOOM'] = 'Yeah'

Heh?                 | This is getting boring ;(

>>> BOOM
'Yeah'

------------------------------------
But you just wrap the system frames?
------------------------------------

Yep, this is a tiny wrapper. That's all it is.

----------
Thank you!
----------

Goodbye!

About

Python stack frames goodies.

Resources

License

Stars

Watchers

Forks

Packages

No packages published