addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwchatcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-crosscrosseditemptyheartfacebookfolderfullheartglobegmailgoogleimagesinstagramlinklocation-pinmagnifying-glassmailminusmoremuplabelShape 3 + Rectangle 1outlookpersonplusprice-ribbonImported LayersImported LayersImported Layersshieldstartrashtriangle-downtriangle-uptwitteruseryahoo

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

From: Thomas E J.
Sent on: Thursday, January 12, 2012 1:54 PM
On Thu, Jan 12, 2012 at 13:39, Mat Schaffer <[address removed]> wrote:
Just when you thought you were safe:

Looks like introducing a local assignment (even if it's never evaluated) throws a wrench in this whole mix (updated to demonstrate).

Back to being the only one that works even if it does bark at me. I think I may try some trickery with exec and execfile to see what I can do there.

Indeed, the global keyword would be needed to manipulate those module level variables within the function. Ah well.

At ~250 lines, I'd probably look at some light refactoring to make this work with less hackery. It shouldn't be too painful to prefix the use of the global vars in the hairy function then use one of the class encapsulated styles mentioned previously. This also has the upside of gaining some insight into what all the hairy code is doing.


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