shortcut for large amount of global var declarations?

Jon Clements joncle at googlemail.com
Sat May 8 10:26:16 EDT 2010


On 8 May, 15:08, Alex Hall <mehg... at gmail.com> wrote:
> Hi all,
> I am sorry if this is the second message about this you get; I typed
> this and hit send (on gmail website) but I got a 404 error, so I am
> not sure if the previous message made it out or not.
> Anyway, I have about fifteen vars in a function which have to be
> global. Is there a faster and more space-efficient way of doing this
> than putting each var on its own line; that is, fifteen "global
> varName" declarations? Thanks.
>
> --
> Have a great day,
> Alex (msg sent from GMail website)
> mehg... at gmail.com;http://www.facebook.com/mehgcap

About 15 that *need* to be global; smells bad to me. However, you can
amend a function's .func_globals attribute. Just wouldn't be going
there myself. Why do you have this many? What's your use case?

Jon.




More information about the Python-list mailing list