why and when we should do it?

S

Su Wei

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.


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

Ò»ÊÀ·çÁ÷ÒÑÆ®¹ý£¬×ªÑÛ½¥³É°×Í·ÎÌ¡£
 
H

Harry George

Su Wei said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,230
Messages
2,571,161
Members
47,796
Latest member
AlphonseNa

Latest Threads

Top