Hello, 

 

1.       When I tried to run the following code (belonging to one Python
program), for the dynamically created object of CUSTOMER as Process type,
the printed PID as the following is always the same. 

 

Why?

 

2. Second question:  When I changed the os.getpid() to os.getppid() or self.
_pid,  the Python’s interpreter generates some error message like
“Customer object has no attribute ‘_pid’”.

 

Thanks for your help!

 

Partly code for the CUSTOMER object:

 

class Customer(Process):

    def buyBaguette(self,cusType,bakery):

        tIn=now()

        print "PID is %d"%(os.getpid())

        yield get,self,bakery.stock,r.choice(buy[cusType])

        waits[cusType].append(now()-tIn)

        

    def __del__(self):

        print "distroy the customer"

 

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to