Paul Sokolovsky wrote:
Well, here it itches to ask if C++-like offsetting of subclass to base
class this pointer was considered,
I suppose in theory it would be possible to build a new
set of __slot__ descriptors for the subclass. It mightn't
even be all that difficult. My guess would be that
It would be a disaster if the base class's slot descriptors would be broken
by that though, so the implementation of slot descriptors would have to
become more complicated. (It's worth understanding how __slots__ works. the
interpreter first finds the slot on the class and then calls its __get__
On Mon, Apr 28, 2014 at 7:26 PM, Paul Sokolovsky pmis...@gmail.com wrote:
Well, sure I did, as I mentioned, but as that's first time I see that
code (that specific piece is in typeobject.c:extra_ivars()), it would
take quite some time be sure I understand all aspects of it. Thanks for
Thanks -- your memory is better than mine!
On Apr 29, 2014 8:16 AM, PJ Eby p...@telecommunity.com wrote:
On Mon, Apr 28, 2014 at 7:26 PM, Paul Sokolovsky pmis...@gmail.comwrote:
Well, sure I did, as I mentioned, but as that's first time I see that
code (that specific piece is in
Hello,
On Tue, 29 Apr 2014 10:47:26 -0400
PJ Eby p...@telecommunity.com wrote:
[]
From memory of the last time I dealt with this, the rules were that
you could mix two classes only if their __slots__ differed from their
common __base__ by *at most* __dict__ and/or __weakref__. The dict
When I redesigned and reimplemented this part of Python inheritance
(somewhere in the 2.1 - 2.3 time frame, I forget the exact timing) I was
well aware of the C++ approach and decided against it, preferring an
approach requiring less compiler assistance that was easier for C
programmers to use and
On 29 April 2014 21:38, Guido van Rossum gu...@python.org wrote:
When I redesigned and reimplemented this part of Python inheritance
(somewhere in the 2.1 - 2.3 time frame, I forget the exact timing) I was
well aware of the C++ approach and decided against it, preferring an
approach requiring
Hello,
It's more or less known fact (ref: google) that you can't inherit from
multiple generic builtin (as in coded in C) types:
class C(dict, list): pass
TypeError: multiple bases have instance lay-out conflict
However, more detailed googling led me to this page of a book:
On Mon, 28 Apr 2014 20:45:48 +0300
Paul Sokolovsky pmis...@gmail.com wrote:
So, is that it, or disjoint native types are supported as bases
somehow? Also, would someone know if a class-subclass case happens for
example in stdlib?
Well, for instance this trivial example works:
class C(list,
Antoine's example works because list inherits from object. The more general
rule compatible layout only allows the rarest of cases to work --
basically the two classes involved must have a common base class and one of
the classes must not add any C-level fields to that base class's layout. I
would
Hello,
On Mon, 28 Apr 2014 20:24:58 +0200
Antoine Pitrou solip...@pitrou.net wrote:
On Mon, 28 Apr 2014 20:45:48 +0300
Paul Sokolovsky pmis...@gmail.com wrote:
So, is that it, or disjoint native types are supported as bases
somehow? Also, would someone know if a class-subclass case
Hi Paul,
On Mon, 28 Apr 2014 21:42:02 +0300
Paul Sokolovsky pmis...@gmail.com wrote:
Basically, if two classes have compatible layouts, you can inherit
from both at once.
How is compatible layout defined? Or layout for that matter at
all?
See Guido's answer. I don't think it's
On Mon, Apr 28, 2014 at 11:42 AM, Paul Sokolovsky pmis...@gmail.com wrote:
Well, it's easy to treat object class as a special-case, null
class.
But the implementation doesn't, at least not for the question you're asking.
So, let's re-formulate questions above with where such
native base
On Mon, Apr 28, 2014 at 12:02 PM, Antoine Pitrou solip...@pitrou.netwrote:
On Mon, 28 Apr 2014 21:42:02 +0300
Paul Sokolovsky pmis...@gmail.com wrote:
Basically, if two classes have compatible layouts, you can inherit
from both at once.
How is compatible layout defined? Or layout
Hello,
On Mon, 28 Apr 2014 12:08:40 -0700
Guido van Rossum gu...@python.org wrote:
[]
How is compatible layout defined? Or layout for that matter at
all?
The layout is what the C struct defining the object looks like. These
are typically defined in headers in the Include directory
15 matches
Mail list logo