#! 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 <[EMAIL PROTECTED]> 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: <[EMAIL PROTECTED]> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Lines: 43 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: <[EMAIL PROTECTED]> Mime-Version: 1.0 Date: Wed, 30 Mar 2005 14:16:34 GMT Xref: news.xs4all.nl comp.lang.python:369917
Su Wei <[EMAIL PROTECTED]> 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. -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list