[Tutor] Re: Python Class functionality idiosyncrasy..

Andrei project5 at redrival.net
Wed Oct 22 07:13:04 EDT 2003


dhanvik at gmx.net wrote:

> Dear Andrei,
> thats right .. Dynamic Checking in Python is the reason that 
> the base class is allowing the using of function that is 
> yet to be defined any there else in the program. But the 
> function can be accessed using the 'self' variable..
> 
> Any program that would be implemented this way would be bad 
> programming and more than that bad designing of OO 
> structure for the prgram. 
> 
<snip>
Hm... well, if it makes you feel more comfortable (and I suppose it 
would be better design too), you can define a dummy method in base1:

 >>> class base1:
...     def baseFunc1(self):
...         self.derivedFunc()
...     def derivedFunc(self):
...         """Dummy method, override by children"""
...         pass

-- 
Yours,

Andrei

=====
Mail address in header catches spam. Real contact info (decode with rot13):
cebwrpg5 at bcrenznvy.pbz. Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V 
ernq gur yvfg, fb gurer'f ab arrq gb PP.





More information about the Tutor mailing list