Skip to content Skip to sidebar Skip to footer
Showing posts with the label Metaprogramming

Self Decompressing And Executing Code In Python

This is the code that creates a compressed file with arbitrary python code in it. The idea is that … Read more Self Decompressing And Executing Code In Python

Detecting Infinite Recursion

I'm creating a macro for Trac, and one of the things it does is to render a bit of wiki text, t… Read more Detecting Infinite Recursion

How Do I Return The Definition Of A Class In Python?

Say I have a class 'NumberStore' class NumberStore(object): def __init__(self, num): … Read more How Do I Return The Definition Of A Class In Python?

Dynamically Decorate A Function Inside A Class In Python3

This is an extension of Dynamic/runtime method creation (code generation) in Python @John Montgomme… Read more Dynamically Decorate A Function Inside A Class In Python3

Equivalent Of Python Eval In Haskell

There is function in python called eval that takes string input and evaluates it. >>> x = … Read more Equivalent Of Python Eval In Haskell