[Python-Dev] New PEP: 319

Michel Pelletier michel@dialnetwork.com
Mon, 16 Jun 2003 01:51:02 -0500 (CDT)


> On Mon, 16 Jun 2003, Michel Pelletier wrote:
>
>>             def __init__(self):
>>                  self.counter = 0
>>
>>             def increment(self):
>>                 synchronize:
>>                     self.counter += 1
>
> What about just adding a parameter to try operator?
>
>              def increment(self):
>                  try self.counter_lock:
>                      self.counter += 1

Because I would like to remove the user-visible lock entirely.  Although
your idea is similar to PEP 310, which proposes a new keyword "with".  I
think using the try keyword for this is inapropriate.

-Michel