(no subject)
Wed Mar 30 09:35:01 EST 2005
#! rnews 1551
Newsgroups: comp.lang.python
Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp
From: Harry George <harry.g.george at boeing.com>
Subject: Re: why and when we should do it?
X-Nntp-Posting-Host: cola2.ca.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <xqxis39xlq5.fsf at cola2.ca.boeing.com>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
Lines: 43
Sender: hgg9140 at cola2.ca.boeing.com
Organization: The Boeing Company
References: <mailman.1044.1112146712.1799.python-list at python.org>
Mime-Version: 1.0
Date: Wed, 30 Mar 2005 14:16:34 GMT
Xref: news.xs4all.nl comp.lang.python:369917
Su Wei <pollux.suwei at gmail.com> writes:
> hi,everybody,Sorry to bother you.
> i hvae seen some code like this before:
>
> class BusinessBO :
> dev __init__(slef):
> #write you own code here
> dev businessMethod :
> #write you own code here
> pass
>
> why and when we should add the keyword "pass" ?
>
> and some time i have seen
>
> class SomeObject(Object) :
> #some code
>
> why and when we should inherit Object?
>
> thanks in advanced.
>
There are enough typos in your example that I'm guessing you actually saw:
class BusinessBO :
def __init__(self):
#write you own code here
pass
def businessMethod(self):
#write you own code here
pass
"pass" is the Python way to say "Yes, I know there should be code
here, but I don't want any." It is required in this context because a
"def" cannot be totally empty.
--
harry.g.george at boeing.com
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
More information about the Python-list
mailing list