Re: [PhillyPUG] Python hackery, any better ideas?

From: Mat S.
Sent on: Thursday, January 12, 2012 12:53 PM
Oooo... well done Dustin. I think we may have a winner. Here's what I came up with: https://gist.github.com/1601533#file_bettercode.py

No warnings, seems to work well. It's interesting to me is that this works with globals() but not locals(). It seems like locals() lets you set existing locals but not define new ones, but globals() can do either.

Kevin, your mention of exec is interesting as is execfile. I may be able to to use those to make my overrides even less invasive into the original code. You meant exec('foo') though right? exec(foo()) gives me an error over here.

-Mat

On Thu, Jan 12, 2012 at 12:28 PM, Dustin Getz <[address removed]> wrote:
mat,

the gevent library does some funky scope stuff when it monkey patches the sockets module etc. maybe it will give you some ideas. see first 130 lines:

Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy