Everybody has already explained why this doesn't work and a possible
"solution" using metaclasses was suggested. I tried to implement it,
ended up with monkey-patching __bases__, which is certainly an
abomination (will it be possible in python 3.0?) but seems to do the
trick.
class _InheritFromOut
On Mar 7, 7:46 pm, DBak <[EMAIL PROTECTED]> wrote:
> > > > > However I can't do this, because, of course, the name Tree isn't
> > > > > available at the time that the classes _MT and _Node are defined, so
> > > > > _MT and _Node can't inherit from Tree.
>
> > > > Not only is the name not defined
On Mar 7, 3:41 pm, [EMAIL PROTECTED] wrote:
> On Mar 7, 4:39 pm, DBak <[EMAIL PROTECTED]> wrote:
>
> > On Mar 7, 1:19 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote:
>
> > > On Fri, Mar 7, 2008 at 3:00 PM, DBak <[EMAIL PROTECTED]> wrote:
> > > > However I can't do this, because, of course, the name
On Mar 7, 6:39 pm, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
> On Fri, 07 Mar 2008 14:26:25 -0800, castironpi wrote:
> > Humans have enormous "mental stacks"--- the stacks the contexts the
> > speakers speak in push things they're hearing on to.
>
> This is not true.
Oh yeah.
On Fri, 07 Mar 2008 14:26:25 -0800, castironpi wrote:
> Humans have enormous "mental stacks"--- the stacks the contexts the
> speakers speak in push things they're hearing on to.
This is not true.
Human beings have extremely shallow mental stacks, limited by short-term
memory. Most people are c
On Mar 7, 4:39 pm, DBak <[EMAIL PROTECTED]> wrote:
> On Mar 7, 1:19 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote:
>
> > On Fri, Mar 7, 2008 at 3:00 PM, DBak <[EMAIL PROTECTED]> wrote:
> > > However I can't do this, because, of course, the name Tree isn't
> > > available at the time that the class
On Mar 7, 1:19 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote:
> On Fri, Mar 7, 2008 at 3:00 PM, DBak <[EMAIL PROTECTED]> wrote:
> > However I can't do this, because, of course, the name Tree isn't
> > available at the time that the classes _MT and _Node are defined, so
> > _MT and _Node can't in
On Mar 7, 3:19 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote:
> On Fri, Mar 7, 2008 at 3:00 PM, DBak <[EMAIL PROTECTED]> wrote:
>
> > I would like to build a class for a data structure such that nodes of
> > the data structure - of interest only to the data structure
> > implementation itself and
On Fri, Mar 7, 2008 at 3:00 PM, DBak <[EMAIL PROTECTED]> wrote:
> I want - but cannot get - a nested class to inherit from an outer
> class. (I searched the newsgroup and the web for this, couldn't find
> anything - if I missed an answer to this please let me know!)
>
> I would like to build a
Use metaclasses?
DBak wrote:
> I want - but cannot get - a nested class to inherit from an outer
> class. (I searched the newsgroup and the web for this, couldn't find
> anything - if I missed an answer to this please let me know!)
>
> I would like to build a class for a data structure such that
Sorry - code for the class should read:
class Tree(object):
...class _MT(Tree):
..def isEmpty(self): return True
..def insert(self, X): return Tree._Node(X)
...class _Node(Tree):
..def isEmpty(self): return False
..def insert(self, X): return _Node(X, self, Tree._MT())
...def __ini
I want - but cannot get - a nested class to inherit from an outer
class. (I searched the newsgroup and the web for this, couldn't find
anything - if I missed an answer to this please let me know!)
I would like to build a class for a data structure such that nodes of
the data structure - of intere
12 matches
Mail list logo