Hey Josiah,
I just spent a couple hours with your example, and it explains a lot. Some
of your interactive session got garbled, so am reposting your
merged_namespace example, with tweaks:
#-
def merged_namespace(*ns):
try:
__builti
Warren Stringer wrote:
> Josiah Carlson wrote:
>> >>> foo = type(foo)(foo.func_code, d, foo.func_name, foo.func_defaults,
>> foo.func_closure)
>
> Wow! I've never seen that, before. Is there documentation for `type(n)(...)`
> somewhere? I did find a very useful "Decorator for Binding Constants, b
Josiah Carlson wrote:
> >>> foo = type(foo)(foo.func_code, d, foo.func_name, foo.func_defaults,
> foo.func_closure)
Wow! I've never seen that, before. Is there documentation for `type(n)(...)`
somewhere? I did find a very useful "Decorator for Binding Constants, by
Raymond Hettinger", that uses t
Warren Stringer wrote:
> Am still trying to hook a NameError exception and continue to run. After a
> few more hours of searching the web and pouring over Martelli's book, the
> closest I've come is:
[snip]
> Is there a way of intervening as `exec cmd in globals, locals` attempts to
> translate 'c'
> Yes. Python doesn't have restartable exceptions. Perhaps you would like
> to take a look at CL or Smalltalk?
>
> Jean-Paul
Hmmm, I wonder if anyone suggest to Philippe Petit, as stepped out 110
stories off the ground, that perhaps he would like to take a look at a
different tightrope?
Oddly
On Sat, 9 Jun 2007 13:52:19 -0700, Warren Stringer <[EMAIL PROTECTED]> wrote:
>Am still trying to hook a NameError exception and continue to run. After a
>few more hours of searching the web and pouring over Martelli's book, the
>closest I've come is:
>
import sys
def new_exit(arg=0):
>..
Am still trying to hook a NameError exception and continue to run. After a
few more hours of searching the web and pouring over Martelli's book, the
closest I've come is:
>>> import sys
>>> def new_exit(arg=0):
... print 'new_exit called'
... #old_exit(arg)
...
>>> def hook(type, value, tb
Warren Stringer wrote:
> Here is what I would like to do:
>
> #
> a = Tr3() # implements domain specific language
> a.b = 1# this works, Tr3 overrides __getattr__
> a.__dict__['b'] = 2# just so you know th
Here is what I would like to do:
#
a = Tr3() # implements domain specific language
a.b = 1# this works, Tr3 overrides __getattr__
a.__dict__['b'] = 2# just so you know that b is local
a[b] = 3