Can global variable be passed into Python function?

Chris Angelico rosuav at gmail.com
Fri Feb 28 21:03:53 EST 2014


On Sat, Mar 1, 2014 at 12:59 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> However, the example as given won't quite work. You never instantiate the
> Idle etc. classes, which means the methods won't work. You need to make
> them class methods or static methods, or perform some metaclass magic
> prevent them from being turned into instance methods when called.

Actually, he does - setting a state means instantiating that state. I
still don't see where the benefit is, beyond that you reach the right
margin quicker than anyone else does.

ChrisA



More information about the Python-list mailing list