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

Fredrik Lundh fredrik at pythonware.com
Thu May 29 00:47:36 EDT 2003


Steven Taschuk wrote:

>   [...]
> >         ## 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)>>'
> >         except '2':
> >             inner_var = '<<value bound in scope of "case" 2>>'
> >         except:
> >             inner_var = '<<value bound in scope of "case" default>>'
>
> Yikes.
>
> Inherently fragile due to reliance on interning of repr(x).

repr does not intern the result.  but the string type caches single
character strings (unless you switch that off when building Python)

> Won't work at all if/when string exceptions go away.

or for cases larger than 9.

</F>








More information about the Python-list mailing list