OT: Re: Just took a look in the perl newsgroup....

Greg Ewing (using news.cis.dfn.de) g2h5dqi002 at sneakemail.com
Thu May 29 02:14:58 EDT 2003


Bengt Richter wrote:
> def f(x):
>     def g(x):
>         inner_var = 5      
>         ## a local case structure with rebinding in local scope
>         try: raise `x`
>         except '1':
>             # case code in same scope as case
>             inner_var = '<<value bound in scope of "case" 1)>>'
 >         ...

Nice try, but unfortunately it's not guaranteed to work,
since string exceptions are matched by identity rather
than value.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg





More information about the Python-list mailing list