Antoon Pardon wrote:
>
>
> Op 9/04/20 om 18:37 schreef Peter Otten:
>> Antoon Pardon wrote:
>>
>>> I am experimenting with subclasses that all need the same metaclass as
>>> the base class. Is there a way to make the metaclass be inherited, so
>>&
Pieter van Oostrum writes:
> Your Pardon is not a class, it is a function. Class A is created by
> type(cls, *args), so 'type' is the metaclass of A, and therefore also of
> B.
> Creation of B does not call Pardon.
With a class it *does* work:
In [74]: class Pardon(t
On 11/04/20 12:19 am, Pieter van Oostrum wrote:
Your Pardon is not a class, it is a function.
To elaborate on that a bit, the way inheritance of metaclasses
works is that when you define a class, if you don't explicity
specify a metaclass, it uses the class of the base class as
the meta
Antoon Pardon writes:
> Op 9/04/20 om 18:37 schreef Peter Otten:
>> Antoon Pardon wrote:
>>
>>> I am experimenting with subclasses that all need the same metaclass as the
>>> base class. Is there a way to make the metaclass be inherited, so that you
>&g
Op 9/04/20 om 18:37 schreef Peter Otten:
Antoon Pardon wrote:
I am experimenting with subclasses that all need the same metaclass as the
base class. Is there a way to make the metaclass be inherited, so that you
don't have to repeat the "metaclass = MetaClass" with every subc
Antoon Pardon wrote:
> I am experimenting with subclasses that all need the same metaclass as the
> base class. Is there a way to make the metaclass be inherited, so that you
> don't have to repeat the "metaclass = MetaClass" with every subclass.
?
This is not only possi
I am experimenting with subclasses that all need the same metaclass as the
base class. Is there a way to make the metaclass be inherited, so that you
don't have to repeat the "metaclass = MetaClass" with every subclass.
--
Antoon Pardon.
--
https://mail.python.org/mailman/listinfo/python-list
> slots = C.__slots__
> > except AttributeError:
> > assert C is object
> > else:
> > all_slots.update(slots)
> > return all_slots
> >
>
> I have been thinking about
try:
> slots = C.__slots__
> except AttributeError:
> assert C is object
> else:
> all_slots.update(slots)
> return all_slots
>
I have been thinking about this. AFAIU the slots are static data. So
jf...@ms4.hinet.net writes:
> ...
> Hard to find the document of type.__init__. I can only guess it does nothing,
> at least no thing serious, to avoid trouble the metaclass's __init__ may
> cause in a class hierarchy:-)
You always have the possibility to look at the source.
All classes have co
dieter at 2018/10/17 UTC+8 PM 1:15:01 wrote:
> jf...@ms4.hinet.net writes:
> > Gregory Ewing at 2018/10/16 UTC+8 PM 2:01:01 wrote
> >> jf...@ms4.hinet.net wrote:
> >> > class Structure(metaclass=StructureMeta): ...
> >> >
> >> > class PolyHea
jf...@ms4.hinet.net writes:
> Gregory Ewing at 2018/10/16 UTC+8 PM 2:01:01 wrote
>> jf...@ms4.hinet.net wrote:
>> > class Structure(metaclass=StructureMeta): ...
>> >
>> > class PolyHeader(Structure): ...
>> >
>> > As my understanding
Gregory Ewing at 2018/10/16 UTC+8 PM 2:01:01 wrote
> jf...@ms4.hinet.net wrote:
> > class Structure(metaclass=StructureMeta): ...
> >
> > class PolyHeader(Structure): ...
> >
> > As my understanding, the metaclass's __init__ was called when a class was
>
jf...@ms4.hinet.net wrote:
class Structure(metaclass=StructureMeta): ...
class PolyHeader(Structure): ...
As my understanding, the metaclass's __init__ was called when a class was
created. In the above example, both the Structure and PolyHeader called it.
My question is: because the PolyH
class StructureMeta(type):
def __init__(self, clsname, bases, clsdict):
offset = 0
...
...
setattr(self, 'struct_size', offset)
class Structure(metaclass=StructureMeta):
...
...
class PolyHeader(Structure):
...
...
As my understa
Thank you. That clears everything up.
Sent from Mail for Windows 10
From: Cameron Simpson
Sent: Saturday, October 13, 2018 6:06 PM
To: Ryan Johnson
Cc: python-list@python.org
Subject: Re: Single DB connection during class's lifetime.
Metaclass,singletonand __new__() examples and references
On 12Oct2018 13:28, Ryan Johnson wrote:
Thanks for the clarification.
If I am creating a class variable, are you suggesting I perform the “if it
exists, great, otherwise make it” logic in the __init__ block or in the class
definition block? Will that even run in a class definition?
The clas
AM
To: python-list@python.org
Subject: Re: Single DB connection during class's lifetime. Metaclass,singleton
and __new__() examples and references.
On 12/10/2018 01:19, Ryan Johnson wrote:
> I am working on using mysql.connector in a class and have found an example of
> how to crea
On 12/10/2018 01:19, Ryan Johnson wrote:
I am working on using mysql.connector in a class and have found an example of
how to create a single connection that spans the lifetime of all instances of
the class:
https://softwareengineering.stackexchange.com/a/358061/317228
however, I do not under
Ryan Johnson writes:
> I am working on using mysql.connector in a class and have found an example of
> how to create a single connection that spans the lifetime of all instances of
> the class:
>
> https://softwareengineering.stackexchange.com/a/358061/317228
>
> however, I do not understand a
I am working on using mysql.connector in a class and have found an example of
how to create a single connection that spans the lifetime of all instances of
the class:
https://softwareengineering.stackexchange.com/a/358061/317228
however, I do not understand a few things about the class, includ
elds'] = tuple(clsdict['__annotations__'].items())
_cls = type.__new__(metacls, cls, bases, clsdict)
return _cls
And test class:
class MyClass(metaclass=DataMeta):
a: float
barattr: int = 2
jik = 12
bzik: int =14
def foo(self, param):
Skip Montanaro wrote:
>> Another round, this time with a metaclass. As you have found partial()
>> does not work as a method because it's not a descriptor (i. e. no
>> __get__() method). Instead you can try a closure:
>>
>> def make_method(a):
>>
> Another round, this time with a metaclass. As you have found partial() does
> not work as a method because it's not a descriptor (i. e. no __get__()
> method). Instead you can try a closure:
>
> def make_method(a):
> underlying = getattr(SomeOtherClass, a)
> @
Skip Montanaro wrote:
> On Thu, Apr 20, 2017 at 3:19 PM, Peter Otten <__pete...@web.de> wrote:
>
>> If being helpful really is the only purpose of the metaclass you can
>> implement a SomeClass.__dir__() method instead:
>>
>> def __dir__(self):
&g
2017-04-20 15:55 GMT-05:00 Lele Gaifax :
> Does
>
> underlying = getattr(SomeOtherClass, a)
> def _meth(self, *args, _underlying=underlying):
> return _underlying(self._instance, *args)
>
> help?
>
Hi, Lele. Long time no chat...
I thought of that, but with _underlying declared af
On Thu, Apr 20, 2017 at 3:19 PM, Peter Otten <__pete...@web.de> wrote:
> If being helpful really is the only purpose of the metaclass you can
> implement a SomeClass.__dir__() method instead:
>
> def __dir__(self):
> names = dir(self._instance)
> #
Skip Montanaro writes:
> underlying = getattr(SomeOtherClass, a)
> def _meth(self, *args):
> return underlying(self._instance, *args)
Does
underlying = getattr(SomeOtherClass, a)
def _meth(self, *args, _underlying=underlying):
return _unde
key):
> return getattr(self._instance, key)
>
> ... and so on ...
>
> If someone tries help(SomeClass) or dir(SomeClass) today, none of the
> attributes or docstrings defined in SomeOtherClass are shown.
If being helpful really is the only purpose of the metaclass you
(SomeClass) or dir(SomeClass) today, none of the
attributes or docstrings defined in SomeOtherClass are shown. It was almost
a straightforward exercise to write a metaclass which defines methods on
SomeClass which delegate to the underlying method on SomeOtherClass.
My problem is evaluating the return
A small correction...
On Mon, 13 Mar 2017 at 22:36 Matt Wheeler wrote:
> ```
> from unittest.mock import patch
>
> import lorem
>
>
> @patch('lorem.type')
> def test_things(mocktype):
> lorem.quux(metameta.Foo())
>
> lorem.return_value.assert_called_with()
>
this line should of course re
On Mon, 13 Mar 2017 at 00:52 Ben Finney wrote:
> How can I override the metaclass of a Python class, with a
> `unittest.mock.MagicMock` instance instead?
>
At first I misunderstood what you were looking for, and was about to reply
to the effect of "you're too late, the me
How can I override the metaclass of a Python class, with a
`unittest.mock.MagicMock` instance instead?
I have a function whose job involves working with the metaclass of an
argument::
# lorem.py
class Foo(object):
pass
def quux(existing_class):
…
metaclass
Skip Montanaro wrote:
> I stumbled upon this use of a metaclass to modify function docstrings:
>
> http://www.jesshamrick.com/2013/04/17/rewriting-python-docstrings-with-a-metaclass/
>
> In certain circumstances (mostly when extending some Pybind11 wrappers),
> it might be nic
I stumbled upon this use of a metaclass to modify function docstrings:
http://www.jesshamrick.com/2013/04/17/rewriting-python-docstrings-with-a-metaclass/
In certain circumstances (mostly when extending some Pybind11 wrappers), it
might be nice to extend/modify a class's docstring in a si
Hi
I am looking the relationship between some classes
from the enum module
from enum import EnumMeta, Enum
class Color(Enum):
pass
type(EnumMeta)
EnumMeta.__bases__
(,)
so EnumMeta is a metaclass, it is an instance of type
and inherit from type too.
type(Enum
dict) as args.
>
>
> But in case of creating class via class definition("type" act as default
> metaclass), the type is called by following syntax,
>
> type(cls, classname, bases, attrbs)
>
> My doubt is how it possible to pass "cls" as argument(as class is n
Hi All,
I was reading about meta programming in "Pro Django" book.
I came across the "type" class which will be acting as default meta class
for all other class. Also "type" metaclass is where actuall class object is
created
To dynamically create a class:
Dyn
ing like that's available... Not likely
something that would be used very often, but would likely sometimes be
useful.
Thanks,
I am not sure about your question, but I try to explain a bit some
possibilities. If you define a __setattr__ method in the metaclass, then
you can intercept the a
As with most I'm sure, short of using abc's, I've had very little exposure
to metaclasses. So, when digging into abc implementation, I figured it
would be a good idea to dig into metaclasses, their usage and actually try
writing one.
What I did may be contrived, but it was fun nonetheless and a go
is correct. The "class FooMeta(type)..." statement is
syntactic sugar for type.__call__(...). But your description is
incorrect. This doesn't occur when you "call the metaclass type"...
Oh damn! Your are right :) Thanks to you and Peter. Now (I hope...) it
should be c
On Sun, 06 Oct 2013 20:17:33 +0200, Marco Buttu wrote:
> Hi all, I have a question about class creation and the __call__ method.
> I have the following metaclass:
>
> >>> class FooMeta(type):
> ... def __call__(metacls, name, bases, namespace):
> ...prin
Marco Buttu wrote:
> Hi all, I have a question about class creation and the __call__ method.
> I have the following metaclass:
>
> >>> class FooMeta(type):
> ... def __call__(metacls, name, bases, namespace):
> ... print("FooMeta.__call__()")
&
Hi all, I have a question about class creation and the __call__ method.
I have the following metaclass:
>>> class FooMeta(type):
... def __call__(metacls, name, bases, namespace):
... print("FooMeta.__call__()")
From what I undestood, at the end of the clas
all the attributes which are Database* descriptors)?
> I know that I could eschew metaclasses altogether and use a common
> super-class, but this doesn't feel like the right situation for inheritance
> to me. Is a metaclass going to be the cleanest and easiest-to-understand way
> to solve
All:
Like most people, I find the whole metaclass topic pretty obscure, and I
have avoided trying to use one for a while. I am also aware of Tim Peter's
famous advice that if you have to ask whether you need a metaclass, then
you almost certainly don't. But in this case I know I am
= name
> self.description = description
> self.is_active = is_active
>
> def __repr__(self):
> return "<(%d, '%s', '%s', %r)>" % (self.id, self.name,
> self.description, self.isactive)
>
> And
return "<(%d, '%s', '%s', %r)>" % (self.id, self.name,
self.description, self.isactive)
And the error I am getting is this:
TypeError: Error when calling the metaclass bases
metaclass conflict: the metaclass of a derived class must be a
(no
me in separate files.
>
> Using Python 3.3's ChainMap type, and some metaclass trickery, I abuse
> the class keyword to (almost) emulate C++ namespaces:
>
Very interesting. I like the idea of continuing the namespace meme.
My idea of using the builtins (in the prior list thread of &qu
C++ namespaces are useful for encapsulating related objects within a
single file, subdividing the global namespace without using classes.
Python has modules, but they come in separate files.
Using Python 3.3's ChainMap type, and some metaclass trickery, I abuse
the class keyword to (a
On Mon, Sep 24, 2012 at 11:43 AM, Chris Withers wrote:
> Hi All,
>
> Is there a metaclass-y way I could cause the following:
>
> class TheParser(Parser):
> def handle_ARecord(self):
> pass
> def handle_ARecord(self):
> pass
>
> ...to rais
Hi All,
Is there a metaclass-y way I could cause the following:
class TheParser(Parser):
def handle_ARecord(self):
pass
def handle_ARecord(self):
pass
...to raise an exception as a result of the 'handle_ARecord' name being
reused?
cheers,
Chris
--
On Tue, 17 Jul 2012 05:23:22 -0700, Michele Simionato wrote:
> The standard is to use `cls`. In the __new__ method you can use `mcl` or
> `meta`.
Thanks to everyone who answered.
I think I will stick with "meta" and "cls".
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Jul 17, 2012 at 12:10 AM, alex23 wrote:
> On Jul 17, 1:29 am, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote:
>> Here's a style question for you: in a metaclass, what should I call the
>> instance parameter of methods, "cls" or "
On Tue, Jul 17, 2012 at 6:23 AM, Michele Simionato
wrote:
> The standard is to use `cls`. In the __new__ method you can use `mcl` or
> `meta`.
I've also seen `mcs` a fair amount.
--
http://mail.python.org/mailman/listinfo/python-list
The standard is to use `cls`. In the __new__ method you can use `mcl` or `meta`.
--
http://mail.python.org/mailman/listinfo/python-list
On 7/16/2012 11:29 AM, Steven D'Aprano wrote:
Here's a style question for you: in a metaclass, what should I call the
instance parameter of methods, "cls" or "self"?
class ExampleMeta(type):
def method(self, *args): ...
I'm not quite sure if that feels
Here's a style question for you: in a metaclass, what should I call the
instance parameter of methods, "cls" or "self"?
class ExampleMeta(type):
def method(self, *args): ...
I'm not quite sure if that feels right. On the one hand, self is the
ExampleMeta
On Jun 5, 10:48 am, Steven D'Aprano wrote:
> Apparently it gives an error. Can anyone explain why this does not work?
>
> # Python 3.2
>
> >>> class MyType(type): # A metaclass...
>
> ... def __repr__(self):
> ... s = super().__repr__()
>
On Tue, Jun 5, 2012 at 2:48 AM, Steven D'Aprano
wrote:
> I was playing around with metaclasses and I wondered what would happen if
> the metaclass itself had a metaclass. Sort of a metametaclass.
>
> Apparently it gives an error. Can anyone explain why this does not work?
In y
Steven D'Aprano wrote:
> I was playing around with metaclasses and I wondered what would happen if
> the metaclass itself had a metaclass. Sort of a metametaclass.
>
> Apparently it gives an error. Can anyone explain why this does not work?
>
> # Python 3.2
>
&g
I was playing around with metaclasses and I wondered what would happen if
the metaclass itself had a metaclass. Sort of a metametaclass.
Apparently it gives an error. Can anyone explain why this does not work?
# Python 3.2
>>> class MyType(type): # A metaclass...
... def __re
> Ok,
>
> After reading all posts (thanks a lot), I am considering to use the
> following base metaclass for all metaclasses that must lead to
> pickleable instances (not pickleable classes):
>
>
> import sys
>
> class Meta(type):
>def __new__(mcls, name, b
ickle cannot find the class definitions of the instances. I am trying
> to add a line to the __new__ of the metaclass to add the new class
> under the right name in the right module/place, so pickle can find
> it.
>
> Is this the right approach? Can anyone explain to me where/how to
lars van gemerden wrote:
>> import pickle
>> import sys
>>
>> class MetaClass(type):
>> pass
>>
>> class M(object):
>> def __init__(self, module):
>> self.__module = module
>> def __getattr__(self, name):
>&
On Fri, Dec 30, 2011 at 9:51 AM, lars van gemerden wrote:
> I still wonder whether it might be easier to add the class to the
> namespace. Can anyone help me with that?
from mypackage import mymodule
setattr(mymodule, myclass.__name__, myclass)
--
http://mail.python.org/mailman/listinfo/python-
.
>
> > > > Pickle cannot find the class definitions of the instances. I am trying
> > > > to add a line to the __new__ of the metaclass to add the new class
> > > > under the right name in the right module/place, so pickle can find
> > > > it.
&
ollowing:
>
> > > I am using metaclasses to make classes and these classes to make
> > > instances. Now I want to use multiprocessing, which needs to pickle
> > > these instances.
>
> > > Pickle cannot find the class definitions of the instances. I am trying
>
sses and these classes to make
>> > instances. Now I want to use multiprocessing, which needs to pickle
>> > these instances.
>>
>> > Pickle cannot find the class definitions of the instances. I am trying
>> > to add a line to the __new__ of the metaclas
to use multiprocessing, which needs to pickle
> > these instances.
>
> > Pickle cannot find the class definitions of the instances. I am trying
> > to add a line to the __new__ of the metaclass to add the new class
> > under the right name in the right module/place, so pi
to use multiprocessing, which needs to pickle
> > these instances.
>
> > Pickle cannot find the class definitions of the instances. I am trying
> > to add a line to the __new__ of the metaclass to add the new class
> > under the right name in the right module/place, so pi
> Pickle cannot find the class definitions of the instances. I am trying
> to add a line to the __new__ of the metaclass to add the new class
> under the right name in the right module/place, so pickle can find
> it.
>
> Is this the right approach? Can anyone explain to me where/how
instances. I am trying
to add a line to the __new__ of the metaclass to add the new class
under the right name in the right module/place, so pickle can find
it.
Is this the right approach? Can anyone explain to me where/how to add
these classes for pickle to find and maybe why?
Can you post some
__new__ of the metaclass to add the new class
under the right name in the right module/place, so pickle can find
it.
Is this the right approach? Can anyone explain to me where/how to add
these classes for pickle to find and maybe why?
Thanks in advance,
Lars
--
http://mail.python.org/mailman/listinfo
On Wed, Nov 2, 2011 at 1:40 PM, Ian Kelly wrote:
>
> If you want to customize the dict you need to do it in __new__, not
> __init__. By the time __init__ is called, the class has already been
> created.
>
> class MetaClass(type):
> def __new__(mcs, name, bases, dict):
thod automatically, but I don't get result what I want.
> (python 2.5.5)
>
> import sys
> from types import FunctionType
>
> class MetaClass(type):
> def __init__(cls, name, bases, dct):
> ## converts instance methods to static methods autom
On Tue, Nov 1, 2011 at 10:02 PM, Makoto Kuwata wrote:
> I tried the following code which converts instance mthods into
> static method automatically, but I don't get result what I want.
> (python 2.5.5)
>
> import sys
> from types import FunctionType
>
)
Geeting.hello():#=> "Hello!"
Geeting.goodbye(): #=> "Good Bye!"
I tried the following code which converts instance mthods into
static method automatically, but I don't get result what I want.
(python 2.5.5)
import sys
from types import F
is circular and a bit confusing. These
> fundamental objects are created special.
The code snippet is here to illustrate how it is visible in the
interpreter. But
you are right.
> > 2) type is its own metaclass : type(type) is type ?
>
> Only in a purely theoretical way. It doesn&
Type in PyObject that part
is not hard.
> > 2) type is its own metaclass : type(type) is type ?
>
> Yes. Another bit of bootstrapping that the compiler does.
self reference is easy same as referencing PyType from PyObject and
PyObject from PyType.
> > 5) type(any_object) == last_me
On Mon, Aug 22, 2011 at 4:41 PM, Stephen Hansen
wrote:
> Not exactly. Python has two somewhat different object models, "old style
> classes" and "new style classes", with slightly different behavior and
> internal structure.
>
> class Foo: pass
>
> is an "old-style class", dated back to Python's
e at it in the
interpreter, but it doesn't really /mean/ anything because its not how
these objects came to be and is circular and a bit confusing. These
fundamental objects are created special.
> B) type vs metaclass
>
>
> 1) type is the first metaclass ?
emselves objects, and therefore are
instances of object:
>>> isinstance(K, object)
True
Since classes are objects, they have a type, namely ``type``.
This includes ``type`` itself:
* type is an instance of object
* object is an instance of type
* type is a subclass of object
ct.__class__ is type
4) type parent object is object : type.__bases__ == (object,)
B) type vs metaclass
----
1) type is the first metaclass ?
2) type is its own metaclass : type(type) is type ?
3) object's metaclass is type ?
4) other metaclasses *MUST* inherit type ?
5) type(any
On Sat, Aug 6, 2011 at 11:04, Chris Rebert wrote:
> On Sat, Aug 6, 2011 at 12:34 AM, Eli Bendersky wrote:
>> Consider this standard metaclass definition:
>>
>> class MyMetaclass(type):
>> def __init__(cls, name, bases, dct):
>> super(MyMetaclas
Eli Bendersky wrote:
> Consider this standard metaclass definition:
>
> class MyMetaclass(type):
> def __init__(cls, name, bases, dct):
> super(MyMetaclass, cls).__init__(name, bases, dct)
> # do meta-stuff
>
> class Foo(object):
> __metacla
On Sat, Aug 6, 2011 at 12:34 AM, Eli Bendersky wrote:
> Consider this standard metaclass definition:
>
> class MyMetaclass(type):
> def __init__(cls, name, bases, dct):
> super(MyMetaclass, cls).__init__(name, bases, dct)
> # do meta-stuff
&g
Consider this standard metaclass definition:
class MyMetaclass(type):
def __init__(cls, name, bases, dct):
super(MyMetaclass, cls).__init__(name, bases, dct)
# do meta-stuff
class Foo(object):
__metaclass__ = MyMetaclass
The call "super(MyMetaclass, cls)" shou
On Sat, Jun 11, 2011 at 21:39, Terry Reedy wrote:
> What may not be obvious from the docs is that the metaclass calculation
> described in the doc section on class statements is carried out within
> type.__new__ (or after a possible patch, called from within that), so that
> type call
On 6/11/2011 7:38 AM, Steven D'Aprano wrote:
On Sat, 11 Jun 2011 01:33:25 -0400, Terry Reedy wrote:
On 6/10/2011 11:34 PM, Steven D'Aprano wrote:
I have a metaclass in Python 3.1:
class MC1(type):
@staticmethod
def get_mro(bases):
print('
On Sat, 11 Jun 2011 01:33:25 -0400, Terry Reedy wrote:
> On 6/10/2011 11:34 PM, Steven D'Aprano wrote:
>> I have a metaclass in Python 3.1:
>>
>> class MC1(type):
>> @staticmethod
>> def get_mro(bases):
>> print('get_mro called&
On 6/10/2011 11:34 PM, Steven D'Aprano wrote:
I have a metaclass in Python 3.1:
class MC1(type):
@staticmethod
def get_mro(bases):
print('get_mro called')
return type('K', bases, {}).__mro__[1:]
The call to type figures out the proper
I have a metaclass in Python 3.1:
class MC1(type):
@staticmethod
def get_mro(bases):
print('get_mro called')
return type('K', bases, {}).__mro__[1:]
def __new__(cls, name, bases, dict):
mro = None
docstring = dict.get('__doc
On Tue, Feb 1, 2011 at 6:04 AM, Laszlo Nagy wrote:
> How should I represent a Python metaclass on an UML class diagram? I know
> how to represent composition, aggregation and inheritance. But not sure
> about metaclasses. What kind of arrow or line should I use between a class
> and i
On Mon, Jan 31, 2011 at 1:04 PM, Laszlo Nagy wrote:
> How should I represent a Python metaclass on an UML class diagram? I know
> how to represent composition, aggregation and inheritance. But not sure
> about metaclasses. What kind of arrow or line should I use between a class
How should I represent a Python metaclass on an UML class diagram? I
know how to represent composition, aggregation and inheritance. But not
sure about metaclasses. What kind of arrow or line should I use between
a class and its metaclass? Is there a standard for this?
Thanks,
Laszlo
En Thu, 05 Aug 2010 10:46:29 -0300, Roald de Vries
escribió:
I'm trying to create a metaclass that keeps track of its objects, and
implement this as a collections.MutableMapping. That is, something like
this:
class type2(type, MutableMapping):
...
/opt/local/Library/Frame
Hi all,
I'm trying to create a metaclass that keeps track of its objects, and
implement this as a collections.MutableMapping. That is, something
like this:
class type2(type, MutableMapping):
...
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/abc.p
In article <5a3a5737-f1b7-4419-9bb3-088c244a4...@c13g2000vbr.googlegroups.com>,
Carl Banks wrote:
>
>However, Aahz will be by shortly to tell you never to use slots.
Please note that there is an important distinction between "don't use
slots" and "never use slots" -- if you can locate any instan
On May 26, 9:55 pm, Carl Banks wrote:
> I don't want to sound to pessimistic about it, I really wouldn't mind
> a metaclass that makes slots more normal; but you have work to do.
Just as a minor followup, I'll mention that slots and inheritance have
some issues th
1 - 100 of 286 matches
Mail list logo