"> One metaclass (i.e. type) has a class attribute that refers to itself.
>
> Other metaclasses have a class attribute that refers to the metaclass's
> metaclass. I can't think of any situation where a metaclass would be its
> own metaclass except for 'type' itself, but then I think I've got a
>
Duncan Booth a écrit :
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
FWIW, metaclasses do have a class attribute that refers to itself !-)
One metaclass (i.e. type) has a class attribute that refers to itself.
>
Other metaclasses have a class attribute that refers to the metaclass's
metacl
Duncan Booth wrote:
Mike Orr <[EMAIL PROTECTED]> wrote:
That's a misunderstanding of classes vs instances. If you have an
instance of MyClass(Superclass), there is one instance but several
classes. The instance is of MyClass; there is no instance of
Superclass. 'self' has a .__class__ att
Duncan Booth <[EMAIL PROTECTED]> writes:
> In fact, thinking about it a bit more, I think that if you did have
> another metaclass which is its own metaclass then the class cannot
> subclass 'object'.
You could if the metaclass of your metaclass inherited from 'type'.
Then your types could still
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
>
> FWIW, metaclasses do have a class attribute that refers to itself !-)
>
One metaclass (i.e. type) has a class attribute that refers to itself.
Other metaclasses have a class attribute that refers to the metaclass's
metaclass. I can't think of
Mike Orr a écrit :
(snip)
'self' has a .__class__ attribute because it's an
instance, but MyClass and Superclass do not because they're already
classes.
Not true for new-style classes:
>>> class Toto(object): pass
...
>>> Toto.__class__
(snip)
I sometimes wish classes
had a .__class__ at
Mike Orr <[EMAIL PROTECTED]> writes:
> There's a very good reason to use self.__class__: it makes it
> possible to subclass your class.
This really depends on the usage. In the OP's use case, he wanted the
subclasses to share the same lock object defined in the superclass
(because of synchroniza
Mike Orr <[EMAIL PROTECTED]> wrote:
> That's a misunderstanding of classes vs instances. If you have an
> instance of MyClass(Superclass), there is one instance but several
> classes. The instance is of MyClass; there is no instance of
> Superclass. 'self' has a .__class__ attribute because it'
Bruno Desthuilliers wrote:
Gabriel Rossetti a écrit :
Larry Bates wrote:
Gabriel Rossetti wrote:
Hello everyone,
I had read somewhere that it is preferred to use
self.__class__.attribute over ClassName.attribute to access class
(aka static) attributes. I had done this and it seamed to work,
Mike Orr wrote:
On Jun 5, 8:40 am, Gabriel Rossetti <[EMAIL PROTECTED]>
wrote:
Hello everyone,
I had read somewhere that it is preferred to use
self.__class__.attribute over ClassName.attribute to access class (aka
static) attributes. I had done this and it seamed to work, until I
subclassed
On Jun 5, 8:40 am, Gabriel Rossetti <[EMAIL PROTECTED]>
wrote:
> Hello everyone,
>
> I had read somewhere that it is preferred to use
> self.__class__.attribute over ClassName.attribute to access class (aka
> static) attributes. I had done this and it seamed to work, until I
> subclassed a class us
On Thu, Jun 5, 2008 at 11:39 AM, Terry Reedy <[EMAIL PROTECTED]> wrote:
>
> If you want to access the attribute of a particular class, to read or
> write, use that class.
> SomeClass.attr
> Note that no instance is required or relevant.
>
> If you want to read the attrubute of the class of an in
In article <[EMAIL PROTECTED]>,
Gabriel Rossetti <[EMAIL PROTECTED]> wrote:
> Larry Bates wrote:
> > Gabriel Rossetti wrote:
> >> Hello everyone,
> >>
> >> I had read somewhere that it is preferred to use
> >> self.__class__.attribute over ClassName.attribute to access class
> >> (aka static) a
Gabriel Rossetti a écrit :
Larry Bates wrote:
Gabriel Rossetti wrote:
Hello everyone,
I had read somewhere that it is preferred to use
self.__class__.attribute over ClassName.attribute to access class
(aka static) attributes. I had done this and it seamed to work, until
I subclassed a class
Hrvoje Niksic a écrit :
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
writes:
On 5 juin, 17:40, Gabriel Rossetti <[EMAIL PROTECTED]>
wrote:
Hello everyone,
I had read somewhere that it is preferred to use
self.__class__.attribute over ClassName.attribute to access class (aka
static) attributes.
It
Larry Bates wrote:
Gabriel Rossetti wrote:
Hello everyone,
I had read somewhere that it is preferred to use
self.__class__.attribute over ClassName.attribute to access class
(aka static) attributes. I had done this and it seamed to work, until
I subclassed a class using this technique and fr
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
writes:
> On 5 juin, 17:40, Gabriel Rossetti <[EMAIL PROTECTED]>
> wrote:
>> Hello everyone,
>>
>> I had read somewhere that it is preferred to use
>> self.__class__.attribute over ClassName.attribute to access class (aka
>> static) attributes.
>
> It's even
"Casey McGinty" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| On Thu, Jun 5, 2008 at 5:40 AM, Gabriel Rossetti <
| [EMAIL PROTECTED]> wrote:
|
| > Hello everyone,
| >
| > I had read somewhere that it is preferred to use
self.__class__.attribute
| > over ClassName.attribute to acc
On Thu, Jun 5, 2008 at 5:40 AM, Gabriel Rossetti <
[EMAIL PROTECTED]> wrote:
> Hello everyone,
>
> I had read somewhere that it is preferred to use self.__class__.attribute
> over ClassName.attribute to access class (aka static) attributes. I had done
> this and it seamed to work, until I subclass
On 5 juin, 17:40, Gabriel Rossetti <[EMAIL PROTECTED]>
wrote:
> Hello everyone,
>
> I had read somewhere that it is preferred to use
> self.__class__.attribute over ClassName.attribute to access class (aka
> static) attributes.
It's even prefered to use self.attribute, unless you know you have
bot
Gabriel Rossetti wrote:
Hello everyone,
I had read somewhere that it is preferred to use
self.__class__.attribute over ClassName.attribute to access class (aka
static) attributes. I had done this and it seamed to work, until I
subclassed a class using this technique and from there on things s
Hello everyone,
I had read somewhere that it is preferred to use
self.__class__.attribute over ClassName.attribute to access class (aka
static) attributes. I had done this and it seamed to work, until I
subclassed a class using this technique and from there on things started
screwing up. I fi
22 matches
Mail list logo