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 some insight by reading the zens (from the console, 'import this'). The fact is, context management has a syntax that has been accepted. Your first example: > def Synhronised(lock,func): > lock.acquire() > try: > func() > finally: > lock.release() > .... > lock=Lock() > def Some(): > local_var1=x > local_var2=y > local_var3=Z > def Work(): > global local_var3 > local_var3=Here_I_work(local_var1,local_var2,local_var3) > Synhronised(lock,Work) > return asd(local_var3) ... becomes ... def Synchronized(lock): lock.acquire() try: yield None finally: lock.release() def Some(): ... with Synchronized(lock): local_var3 = Here_I_work(local_var1,local_var2,local_var3) ... Which is quite close to what you offer: > Synhronised(lock,block) > local_var3=Here_I_work(local_var1,local_var2,local_var3) It is of my opinion that your proposal is destined to fail for at least two reasons; 1) context management already has an accepted syntax 2) ruby blocks were found (due to lack of evidence to the contrary) to gain Python users very little (if anything) over the accepted context management syntax. To note; unless your post is of the utmost importance, cross-posting to python-list and python-dev seems quite rude to me. Further, a variant of Ruby block syntax was offered way back in February and March (read the python-dev archives available at http://mail.python.org/pipermail/python-dev/ ). Reading what was already discussed may offer you insight into what (if any) open issues were remaining, and precisely why the context management syntax was supported over anonymous blocks/thunks/Ruby blocks. - Josiah -- http://mail.python.org/mailman/listinfo/python-list