Factbites
 Where results make sense
About us   |   Why use us?   |   Reviews   |   PR   |   Contact us  

Topic: Metaclass


  
  Metaclass - Wikipedia, the free encyclopedia
Metaclass programming can be confusing, and it is rare in real-world Python code.
The metaclass of class Sphere is simply referred to as "the metaclass of class Sphere".
The abstract superclass of all metaclasses is Class, which describes the general nature of classes.
en.wikipedia.org /wiki/Metaclass   (622 words)

  
 JOT: Journal of Object Technology - Extending ODMG Metadata to Define External Schemas
This modification involves the revision of the metaclasses MetaObject and DefiningScope for the former, and the revision of the metaclasses Module, Interface and Class for the latter.
As figures 3.a and 3.b show, the modification to the metaschema proposed to include metaclasses for derived classes and derived interfaces, the new abstractions for generic classes and generic interfaces, as well as the derivation relationship, retains the structure of the schema repository as an object-oriented schema.
Therefore, given that ODMG metadata does not include a metaclass for the inheritance relationship, we follow the same approach for the derivation relationship, because although it is a relationship with a different semantic, it is also a relationship between classes that is not identified with a name either.
www.jot.fm /issues/issue_2003_03/article5   (5920 words)

  
 ASPN : Python Cookbook : A dict proxy metaclass.   (Site not responding. Last check: 2007-10-09)
This recipe creates a metaclass, that can be used in any dict-like object to map specially named attributes to keys of that dictionary.
By default, such attributes are those whose name begin with one (and only one) underscore, and they are mapped to the dictionary key of the same name, without the underscore; but the method to determine that behavior is overridable.
Set it as a the metaclass for that class, and you can then access: d["somekey"] as: d._somekey It requires the target class to have the __{setgetdel}item__ methods of a dictionary.
aspn.activestate.com /ASPN/Cookbook/Python/Recipe/496716   (582 words)

  
 Metaclass programming in Python
Classes can inherit metaclasses from their ancestors -- notice that this is not the same thing as having metaclasses as ancestors (another common confusion).
Perhaps the most common use of metaclasses is similar to that of MetaPicklers: adding, deleting, renaming, or substituting methods for those defined in the produced class.
For metaclasses in Python specifically, Guido van Rossum's essay, "Unifying types and classes in Python 2.2" is useful as well.
www-128.ibm.com /developerworks/linux/library/l-pymeta.html   (2188 words)

  
 Python Documentation Index
It is easy to be confused by what exactly happens when using a metaclass, because we lose the absolute distinction between classes and instances: a class is an instance of a metaclass (a ``metainstance''), but technically (i.e.
At the end of the class statement, the metaclass whose metainstance is used as a base class is instantiated, yielding a second metainstance (of the same metaclass).
An obvious problem with that is that it's not easy to combine the features of different metaclasses, while this would actually be quite useful: for example, I wouldn't mind getting a trace from the test run of the Synch module, and it would be interesting to add preconditions to it as well.
www.python.org /doc/essays/metaclasses   (2591 words)

  
 Metaclass programming in Python, Part 2
In our initial article on metaclass programming in Python, we introduced the concept of metaclasses, showed some of their power, and demonstrated their use in solving problems such as dynamic customization of classes and libraries at run-time.
The availability of metaclass attributes is not transitive; in other words, the attributes of a metaclass are available to its instances, but not to the instances of the instances.
For metaclasses in Python specifically, Guido van Rossum's essay, Unifying types and classes in Python 2.2 is useful.
www-128.ibm.com /developerworks/linux/library/l-pymeta2   (1940 words)

  
 ONLamp.com -- A Primer on Python Metaclass Programming
All methods attach to their instances, and the instance of a metaclass is a class.
Classes can inherit metaclasses from their ancestors--notice that this is not the same thing as having metaclasses as ancestors (another common confusion).
You must set the variable in the class definition itself, since the metaclass is not used if the attribute is set later (after the class object has already been created).
www.onlamp.com /pub/a/python/2003/04/17/metaclasses.html   (926 words)

  
 Appendix: Metaclass Identifier List   (Site not responding. Last check: 2007-10-09)
A T3 application stores the identifiers of the metaclasses it uses in its image file; the VM uses these identifiers to allow the application to call code in the metaclasses.
A given metaclass ID string always refers to the same metaclass type, for all VM implementations and for all applications.
Metaclass identifier strings use only 7-bit ASCII characters, and may be from 1 to 255 characters in length.
www.tads.org /t3spec/metalist.htm   (253 words)

  
 10.2 Metaclasses/Metaobject Protocol   (Site not responding. Last check: 2007-10-09)
All classes are represented as an instance of a metaclass.
BD: In the context of Smalltalk and C++, 'metaclass' is used to refer to the place where features of the class (as opposed to those of instances) are found (e.g.
Smalltalk 'class variables' and 'class methods' and C++ 'static members.') In the context of CLOS, 'metaclass' is used to refer to the place where the semantics of the class may be dynamically changed (e.g.
www.objs.com /x3h7/sec102.htm   (351 words)

  
 Instance Class Metaclass Language Squeak Smalltalk   (Site not responding. Last check: 2007-10-09)
So there are three instances for the string 'abc': the String Metaclass, the String Class, and the instance containing the characters 'abc'.
Class and Metaclass are just like other classes, so each of them also have a Class instance and a Metaclass instance.
You noted that: 'Symbol class inspect' is a Metaclass but Symbol class = Metaclass ----> false By the same token, note that '3 class inspect' is a SmallInteger class but 3 class = SmallInteger class ----> false So what shows on the top of the inspector is really one level higher.
www.visoracle.com /squeakfaq/instance-0.html   (347 words)

  
 Metaclass Programming in Python, Part 2: -- Understanding the Arcana of Inheritance and Instance Creation --
In our earlier article on metaclass programming in Python, we introduced the concept of metaclasses, showed some of their power, and demonstrated their use in solving problems such as dynamic customization of classes and libraries at run-time.
the attributes of a metaclass are available to its instances, but not to the instances of the instances.
The metamethod "mm" can be invoked both from either the metaclass or from the class, but not from the instance.
gnosis.cx /publish/programming/metaclass_2.html   (1830 words)

  
 .c( whytheluckystiff )o. -- Seeing Metaclasses Clearly
When an object finds methods in an attached metaclass, these methods are referred to as the object’s singleton methods rather than the object’s metaclass’ instance methods (if you get my drift.) And since there can only be a single metaclass attached to an object, it’s called a _single_ton.
The problem with a metaclass of a metaclass is that there’s not much practical use for them.
When you create a metaclass of a metaclass, it has no affect on the object referred to by the original metaclass.
whytheluckystiff.net /articles/seeingMetaclassesClearly.html   (1605 words)

  
 T3 Metaclasses
The metaclass member functions can all be implemented as calls to the corresponding static methods with the instance's string byte array as an argument.
The metaclass member functions can all be implemented as calls to the corresponding statis methods with the instance's byte array as an argument.
This metaclass behaves as (and is a suclass of) the regular array metaclass; the only difference is that any object references stored within elements of a weak reference array are treated as weak references.
www.tads.org /t3spec/metacl.htm   (3768 words)

  
 Metaclass Programming in Python: -- Pushing Object Oriented Programming to the Next Level --
You must set the variable in the class definition itself since the metaclass is not used is the attribute is set later (after the class object has already been created).
By using a metaclass to create the validity classes, we can generate a DTD out of the class declarations themselves (and add an extra method to the classes while we do it).
could carry with it both a metaclass producer and a set of inheritable methods--the two aspects of its bequest are orthogonal.
gnosis.cx /publish/programming/metaclass_1.html   (1778 words)

  
 Let's keep it simple (or, how to do metaprogramming without metaclasses)
The issue is that once you have defined a custom metaclass for your base class, all the derived classes will inherit the metaclass, so the initialization code will be run on all derived classes, magically and implicitly.
In other words,you should use a custom metaclass only when your real intention is to have code running on derived classes without users of those classes noticing it.
The metaclass will create the class (as a new style one) and will pass it to the class initializer procedure.
www.phyast.pitt.edu /~micheles/python/classinitializer.html   (2151 words)

  
 metaclass that inherits a class of that metaclass? - Python
metaclass that inherits a class of that metaclass?
metaclass and a class using that metaclass, such that one of the bases
of the metaclass is the class created with that metaclass.
www.thescripts.com /forum/thread45558.html   (731 words)

  
 MetaClass - MetaClass
MetaClass supports runtime access to metadata associated with program elements or artefacts.
To get started using MetaClass the developer should first look at the Attribute Model description to see what type of metadata is stored by MetaClass.
After the developer has mastered the common uses-cases of MetaClass they can move on to more advanced usages such as filtering and augmenting metadata during the pre-compilation stage, loading the metadata from alternative sources and integrating MetaClass into a java container.
metaclass.codehaus.org   (171 words)

  
 GNU Smalltalk User's Guide: Metaclass   (Site not responding. Last check: 2007-10-09)
My instances have a single instance, which they hold onto, which is the class that they are the metaclass of.
I provide methods for creation of actual class objects from metaclass object, and the creation of metaclass objects, which are my instances.
If this is confusing to you, it should be...the Smalltalk metaclass system is strange and complex.
www.gnu.org /software/smalltalk/gst-manual/gst_138.html   (368 words)

  
 Module: Meta
Automatically generates a metaclass that satisfies metaclass constraints inherited from the supplied base classes, and then calls it to create a new class.
Generated metaclasses are cached for reuse, and they are automatically given classnames which are the concatenation of their base metaclasses' names.
Metaclasses are derived according to the algorithm in the book "Putting Metaclasses to Work", by Ira R. Forman and Scott H. Danforth.
peak.telecommunity.com /doc/src/peak/util/Meta.html   (390 words)

  
 NetEdit Application Designers Manual
When a module is put on the workspace, we say that its metaclass has been instantiated and use the term 'Instance' to indicate this instantiation (the metaclasses object code is available to NetEdit, and through NetEdit to the C++ interpreter cint).
The metaclass browser is a tool to browse through the metaclass space and to instantiate metaclasses in an alternative way.
As for normal metaclasses, the group is instantiated on the level represented currently on the workspace.
www.win.tue.nl /numlab/olddoc/ned/application-designers   (2728 words)

  
 Dr. Dobb's | The Bistro Programming Language | February 2, 2004
Thus, the smalltalk.behavior.Object class is derived from java.lang.Object and its metaclass is derived from smalltalk.behavior.Class.
Putting the Bistro metaclass methods and variables into another Java class allows the metaclass hierarchy to parallel the class hierarchy as it does in Smalltalk.
In this case, the inheritance and metaclass structures of the generated classes also look like that of smalltalk.behavior.Object; that is, they serve as the root of an inheritance hierarchy derived from a Java base class.
www.ddj.com /dept/java/184405578   (2912 words)

  
 Metaclass with name overloading.
The metaclass receives the dictionary after all declarations were collected, and then it's too late to act upon it.
You said that the metaclass is determined later.
All in order to have the f_locals' kind be set by the *metaclass* rather than by other means -- honestly, it seems the price is too high, unless there are some big advantages connected by the choice of metaclass vs other means that I fail to see.
www.codecomments.com /message287593.html   (2570 words)

  
 [No title]
The stereotype "metaclass" is not mandatory: its main merit is to make clear the focus that one has on it.
The extension defined between a stereotype and a metaclass is a kind of association (see fig 448): at the instance level, you will get the usual objects instanciating an association as shown in fig 458.
Subject RE: Stereotypes applying in UML 2.0 Nerijus, metaclass is a stereotype as recalled in C.1 StandardProfileL1 A class can be both a usual class or a metaclass depending on the focus that the model currently has on it.
www.omg.org /issues/issue8094.txt   (9257 words)

  
 ASPN : Python Cookbook : SOLVING THE METACLASS CONFLICT   (Site not responding. Last check: 2007-10-09)
Consider a class ``A`` with metaclass ``M_A`` and a class ``B`` with
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
is invoked with the same arguments it returns the same metaclass.
aspn.activestate.com /ASPN/Cookbook/Python/Recipe/204197   (524 words)

Try your search on: Qwika (all wikis)

Factbites
  About us   |   Why use us?   |   Reviews   |   Press   |   Contact us  
Copyright © 2005-2007 www.factbites.com Usage implies agreement with terms.