Google Groups Home
Help | Sign in
新手求助 PyScripter调试问题
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Will  
View profile
 More options Apr 4, 2:57 pm
From: Will <YuGuo...@gmail.com>
Date: Fri, 4 Apr 2008 11:57:33 -0700 (PDT)
Local: Fri, Apr 4 2008 2:57 pm
Subject: 新手求助 PyScripter调试问题
代码:
class Person:
        '''Represents a person.'''
        population=0

        def __init__(self,name):
                '''Initializes the person's data.'''
                self.name=name
                print '(Initializing %s)' %self.name

                #When this person is created, he/she adds to the
population
                Person.population+=1

        def __del__(self):
                '''I am dying.'''
                print '%s says bye.' %self.name

                Person.population-=1

                if Person.population==0:
                        print 'I am the last one.'
                else:
                        print 'There are still %d people left.'
%Person.population

        def sayHi(self):
                '''Greeting by the person.

                Really, that's all it does.'''
                print 'Hi, my name is %s.' %self.name

        def howMany(self):
                '''Prints the current population.'''
                if Person.population==1:
                        print 'I am the only person here.'
                else:
                        print 'We have %d persons here.'
%Person.population

swaroop=Person('Swaroop')
swaroop.sayHi()
swaroop.howMany()

kalam=Person('Abdul Kalam')
kalam.sayHi()
kalam.howMany()

swaroop.sayHi()
swaroop.howMany()

这是简明Python教程里的一个例子
我使用PyScripter调试的

2个问题
1.为什么我run第一次和第二次的结果是不同的
2.如何设置断点调试python程序


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google