From: Brian Z. <bz...@ig...> - 2001-04-04 15:03:59
|
( I'm perfectly comfortable being corrected when I'm wrong. ) Point well made, I'll be more careful next time ;) D-Man is indeed correct and offered a better explanation of object vs. class than I did. Sorry for any confusion and thanks for the clarification. brian -----Original Message----- From: jyt...@li... [mailto:jyt...@li...]On Behalf Of D-Man Sent: Wednesday, April 04, 2001 9:30 AM To: Jyt...@li... Subject: Re: [Jython-users] A big problem for me! ( I don't mean to be condescending at all, but I want to make sure this doesn't cause some confusion. ) An object can't be abstract, only classes can. Objects also can't be subclassed, only classes can be subclassed. Also, 'self' hasn't been "called", it was only used to access an attribute. =20 (calling it would look like self() or self( <some arguments here> ) and would require defining the function __call_ ) I think Brian knows this, but mixed a couple of terms around in writing this. Other than the wording issues, everything Brian said is accurate and (hopefully) helpful to you. -D On Tue, Apr 03, 2001 at 03:05:05PM -0500, Brian Zimmer wrote: |=20 | Wayne, | =20 | You can call "self" on an abstract object, you just can't instantiate | an abstract object. An abstract object has all the state and | behaviour of a normal, concrete object it just can't live on it's | own. It needs to be subclassed and made abstract. For a good example | of this, check out the java.io.* packages, in particular, either the | Reader/Writer or InputStream/OutputStream classes and their | subclasses. Look at FileReader and you'll notice it is an | implementation of the abstract Reader class, all FileReader provides | to Reader is how to get the initial data, in this case a File. | =20 | Python really doesn't have the notion of an abstract class, in general | an abstract class or interface is implemented by defining a bunch of | methods which raise Exceptions. | =20 | So in your case, you can't instantiate a Component, but you can get | subclasses of Component and then call methods on them. | =20 | hope this helps, | =20 | brian _______________________________________________ Jython-users mailing list Jyt...@li... http://lists.sourceforge.net/lists/listinfo/jython-users |