After crashing with metaclasses i delved into the topic of metaprogramming in Python and I have a couple of questions that are, imho, n开发者_如何学编程ot clearly anwered in available docs.
I looked through the myriad \'Python exec\' threads on SO, but couldn\'t find one that answered my issue. Terribly sorry if this has been asked before. Here\'s my problem:
Suppose I\'ve got a class: class MyClass def my_method # cool stuff end alias :my_method2 :method end 开发者_Go百科And now I want to get all the aliases for method my_method without comparison with
In Ruby, you can easily access local variables programmatically by using local_variables and eval. I would really 开发者_如何学编程like to have meta-programming access to these variables using a singl
I am writi开发者_如何转开发ng an internal DSL in Ruby.For this, I need to programmatically create named classes and nested classes.What is the best way to do so?I recon that there are two ways to do s
How do I determine what my compiler (g++) is doing with template code? I am using boost.proto (an expression-template library) to evaluate some maths expressions at compile time.The code evaluates th
While reading this question , I came across @Johannes\'s answer. template<typename> struct void_ { typedef void type; };
I\'m trying to create methods dynamically in coffee script, but as my code shows, the iterator I use to create the methods doesn\'t rese开发者_Go百科t its variables between iterations and so I en up w
I\'ve got the following pro开发者_Python百科blem: I need to write a decorator that would be able to detect a situation where it is used around a method and around a regular function.
I would like to allow use of the class I\'m writing to specify as a template parameters a list of types along with a list of allocators of those types in a manner that types are at odd positions and a