metaclass
Add method to metaclass
I\'m just playing with the metaclass programming in Groovy. But suddenly I was facing a little problem which I just could not get working...[详细]
2023-01-29 18:22 分类:问答How to prevent groovy from creating lowercase (meta) property names?
I\'ve a problem. I want to have nice dynamic groovy classes to represent an ugly XML structure (unfortunately JAXB, XmlBeans etc. is not possible).[详细]
2023-01-22 18:08 分类:问答Put a key named metaClass in a Map
I\'ve written a small Groovy script that exposes a very weird behaviour. can anyone explain it ? // Creating a groovy map[详细]
2023-01-21 11:39 分类:问答Get parameters of object in metaclass of this object
My problem is a python/django mix. I have a form model that will display some fields. Basing on some parameter of this model, the data sent to metaclass creating this object should differ. But how can[详细]
2023-01-19 13:17 分类:问答Generic metaclass to keep track of subclasses?
I\'m trying to write a generic metaclass to track subclasses Since I want this to be generi开发者_如何学运维c, I didn\'t want to hardcode any class name within this metaclass, therefore I came up wit[详细]
2023-01-19 12:37 分类:问答Is there a way to emulate the __prepare__ special method of a Python 3-metaclass in Python 2.5?
In my project I have to stick to Python 2.5 (Google App Engine). Somewhere in the application (actually a framework), I have to keep track which variables are defined and in which order they are defin[详细]
2023-01-19 08:20 分类:问答Python : how to prevent a class variable that is a function to be understood as a method?
I am currently implementing a django app, for this I try to use a syntax that is consistent with Django\'s...[详细]
2023-01-16 17:34 分类:问答Dealing with metaclass conflict with SQL Alchemy declarative base
I have a class X which derives from a class with its own metaclass Meta. I want to also derive X from the declarative base in SQL Alchemy. But I can\'t do the simple[详细]
2023-01-14 10:04 分类:问答python: manipulating __dict__ of the class
(All in ActivePython 3.1.2) I tried to change the class (rather than instance) attributes. The __dict__ of the metaclass seemed like the perfect solution. But when I tried to modify, I got:[详细]
2023-01-14 02:24 分类:问答What is the difference between a parameterized class and a metaclass (code examples in Python please)?
Hello Stack Overflow contributers, I\'m a novice programmer learning Python right now, and I came upon this site which helps explain object-oriented paradigms. I know that metacl开发者_如何学JAVAasse[详细]
2023-01-12 07:05 分类:问答