Am 11.11.2009 15:29, schrieb Richard Purdie:
On Wed, 2009-11-11 at 05:04 -0800, Chris Rebert wrote:
On Wed, Nov 11, 2009 at 4:37 AM, Richard Purdie<rpur...@rpsys.net>  wrote:
<snip>
Is there a way to make the "global x" apply to all functions without
adding it to each one?

Thankfully, no.

Hmm :(.

What I'm trying to do is to avoid having "import X" statements
everywhere by changing __builtin__. It seems my approach doesn't have
quite the same effect as a true import though.

And you can't just put all your imports together at the top of the
file because...?

The application in question is bitbake, the parsing tool for the
OpenEmbedded and Poky projects.

We're talking about python code fragments spread across about 8,000
files which make up the "metadata" some of which is public and some of
which is not. Rightly or wrongly bitbake does some interesting things
with its execution contexts for these code fragments.

And you can't just use __import__() to programmatically include some
of the fragments instead of having this local/global weirdness in
funtions in those modules?

Lets just say its not a traditional use case, we know the way bitbake
does some things is evil but it does other things rather well and we
can't break those.

I'd need to see the bigger picture because I don't know of bitbake but I
have a feeling this can be done much nicer in the end.

Regards
Tino

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to