473,386 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

why and when we should do it?

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.
--
ÝëÈ»»ØÊ×Ôø¾*ËêÔ£¬
ëüëÊÖÐÒÀÏ¡ÉÁ˸×ÅÇåÎú¡£
²Å·¢ÏÖ£¬
Ô*À´ÔÚÎҵļÇÒäÉî´¦£¬
»¹²ÐÁô×ÅÄþ¾²¶øÓÖÐÒ¸£µÄ˲¼ä¡£

Ò»ÊÀ·çÁ÷ÒÑÆ®¹ý£¬×ªÑÛ½¥³É°×Í·ÎÌ¡£
Jul 18 '05 #1
1 1161
Su Wei <po**********@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.

--
ha************@boeing.com
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Terry Bell | last post by:
We've had a very large A97 app running fine for the last seven years. I've just converted to SQL Server backend, which is being tested, but meanwhile the JET based version, running under terminal...
7
by: Dan Bass | last post by:
In a somewhat complex application, I've developed plug-in architecture and am having a problem as to when to catch general exceptions for logging purposes. In each plug-in class library, for...
8
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and...
4
by: grayaii | last post by:
Hi, I have a simple form that handles all its paint functionality like so: this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true); And the entry point to this...
27
by: susiedba | last post by:
when you guys have a solution for _ALL_ of those scenarios is when I stop VB 2005 doesn't support code reuse or portability I want to know what I am supposed to do.. am I really still supposed...
58
by: Jorge Peixoto de Morais Neto | last post by:
I was reading the code of FFmpeg and it seems that they use malloc just too much. The problems and dangers of malloc are widely known. Malloc also has some overhead (although I don't know what is...
11
by: MikeT | last post by:
This may sound very elementary, but can you trap when your object is set to null within the object? I have created a class that registers an event from an object passed in the constructor. When...
1
by: pdesh3 | last post by:
Hi, I am not getting any idea how to implement this: I have a form for which I need to create a top banner kind of the thing on top section of the Form. It should contain the feilds as...
94
by: Samuel R. Neff | last post by:
When is it appropriate to use "volatile" keyword? The docs simply state: " The volatile modifier is usually used for a field that is accessed by multiple threads without using the lock...
44
by: Smokey Grindle | last post by:
I have a list box on my form, but I need to databind it to a data table that is a private member of the form's class... so I basically have Public Class MyForm priate m_MyTable as new datatable...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.