is Python fully object oriented ?

David C. Ullrich ullrich at math.okstate.edu
Sat Jan 13 13:31:31 EST 2001


In article <PTM76.33769$ge4.13694384 at news2.rdc2.tx.home.com>,
  "Rainer Deyke" <root at rainerdeyke.com> wrote:
> "David C. Ullrich" <ullrich at math.okstate.edu> wrote in message
> news:93nifo$qa7$1 at nnrp1.deja.com...
> > A person could invent syntax to do exactly that one thing
> > with an implicit self, maybe with an "inherited" keyword
> > as in the one language I know with an implicit self (Object
> > Pascal). How would a person do
> >
> > class C(A, B):
> >   def __init__(self):
> >     A.__init__(self)
> >     B.__init__(self)
> >
> > with an implicit self?
>
> The following is valid C++:
[...]
>
> A better example might be a non-constructor function:

Yes.

> struct A {
>   void f() {}
> };
>
> struct B {
>   void f() {}
> };
>
> struct C : A, B {
>   void f() { A::f(); B::f(); }
> };

Ok. I won't ask how you would call a method of
another class passing something other than the
current instance in place of an implicit self -
probably you'd have an answer, and if you didn't
it would be a slightly contrived question anyway.

I can't help it, I have to ask. All the examples
so far have been a little special, like the
"other" class is an ancestor. Can a person do
something equivalent to

AnyClassAtAll.AMethod(AnyInstanceOfAnyOtherClass)

with an implicit self? (It just seems to me that
an explicit self _must_ be more general than
an implicit self, allowing _something_ that an
implicit self doesn't. Maybe not.)

Besides, I was wondering how you'd do it in Python,
not in C++. (haha)

> --
> Rainer Deyke (root at rainerdeyke.com)
> Shareware computer games           -           http://rainerdeyke.com
> "In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor
>
>

--
Oh, dejanews lets you add a sig - that's useful...


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list