metaclass
Python __metaclass__ inheritance issue
My issue is that I am using a metaclass to wrap certain class methods in a timer for logging purposes.[详细]
2023-04-12 15:41 分类:问答Grails: Added methods during runtime available in tests?
I am trying to test a controller which, in particular, is using java.io.File and some of the methods/attributes injected by Grails during runtime, like:[详细]
2023-04-12 05:00 分类:问答Python 2.x metaclass generated wrappers break inspect
I\'m having an issue where I have wrapped some class methods using a metaclass, but now if I use the help() built-in the methods are displayed as the wrapper instead of the original method.[详细]
2023-04-12 04:50 分类:问答Groovy newInstance() method missing after set metaClass
I define an metaclass class MyMetaClass extends DelegatingMetaClass { MyMetaClass(Class theClass){ super(theClass)[详细]
2023-04-08 22:40 分类:问答How can Class be of the Class class and not have Class instance methods?
I was studying how the Ruby interpreter is implemented, and one question occurred that didn\'t get an answer yet for me. That\'s the one in the title: since Class (r_cClass) has super set to itself (i[详细]
2023-04-08 10:45 分类:问答Metaclass conflict, multiple inheritance, and instance as parent
I\'ve been messing around with the dark arts of Python and there\'s something I\'d like help understanding. Given a class Foo, here\'s some ways I attempted to inherit from it:[详细]
2023-04-06 06:42 分类:问答Overriding grails controller chain method via metaClass having no effect
Consider the following controller: package test class FirstController { def index = { chain(controller:\"second\",[详细]
2023-04-03 04:30 分类:问答Auto register a class when it's defined (but without importing it anywhere)
I would like to register a class (not an instance) when it\'s created... but without importing it. Basically, I want to do what\'s described here:[详细]
2023-04-01 08:16 分类:问答python metaclass doesn't remember the new value
I wrote a class Person with a metaclass Spell. In the metaclass I change an attribute and it is ok, but if i want to use this new value for another operation, it doesn\'t work and it use the previous[详细]
2023-03-31 05:26 分类:问答Create property in class in __init__
How I\'m can create a property for class in init? If I\'m use this code: In [1]: import functools In [2]: def test(id, wrap):[详细]
2023-03-28 08:30 分类:问答