OT: Re: Just took a look in the perl newsgroup....
Steven Taschuk
staschuk at telusplanet.net
Wed May 28 16:17:37 EDT 2003
Quoth Bengt Richter:
[...]
> IMO that's still a workaround for the case (;-) where you want to rebind
> in the same scope. But I just thought of an alternative, which see below
> in stripped-down version of previous example:
[...]
> ## 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). Won't
work at all if/when string exceptions go away.
A strong candidate for a Most Outlandish Proposal award. (In
fact, I think you're a strong candidate for a Lifetime Achievement
Award in this area. <0.25 wink>)
--
Steven Taschuk staschuk at telusplanet.net
Receive them ignorant; dispatch them confused. (Weschler's Teaching Motto)
More information about the Python-list
mailing list