Re: [Python-Dev] PEP-343 - Context Managment variant

2005-08-08 Thread Josiah Carlson
falcon <[EMAIL PROTECTED]> wrote: > It's idea was token from Ruby. But I think, good idea is good whatever it > came from. > It can be not Pythonic. Just because something may be a good idea, doesn't mean that the idea is Pythonic. The only person who can truely say is Guido, but you can gain s

PEP-343 - Context Managment variant

2005-08-04 Thread falcon
Sorry. I was wrong about "global" statement. Then examples seems to be even more intricate: def Synhronised(lock,func): lock.acquire() try: func() finally: lock.release() lock=Lock() def Here_I_work(*a): return 1 # Stub def asd(a): retur

Re: PEP-343 - Context Managment variant

2005-08-04 Thread Terry Reedy
"falcon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > def Synhronised(lock,func): >lock.acquire() >try: >func() >finally: >lock.release() > > lock=Lock() > def Some(): >local_var1=x >local_var2=y >local_var3

PEP-343 - Context Managment variant

2005-08-04 Thread falcon
I know I came after the battle. And I have just another sight on context managment. Simple Context Managment may look in Python 2.4.1 like this: Synhronized example: def Synhronised(lock,func): lock.acquire() try: func() finally: lock.rele