Statespressions? (Re: Draft Pep (was: Re: Let's Talk About Lambda Functions!))
tanzer at swing.co.at
Thu Aug 8 08:06:07 CEST 2002
amuys at shortech.com.au (Andrae Muys) wrote :
> Greg Ewing <see_reply_address at something.invalid> wrote in message news:<3D509834.8050800 at something.invalid>...
> > Jonathan Hogg wrote:
> > > On 6/8/2002 5:11, in article K%H39.4832$7n5.2407 at sccrnsc01, "Emile van
> > > Sebille" <emile at fenx.com> wrote:
> > >>Except for the dict and implied indent level, isn't this a module?
> > >>
> > >>import callbacks
> > >>callbacks = callbacks.__dict__
> > >>callbacks['case a']
> > >>
> > All these things add up to a bit more obscurity and a
> > bit less economy of expression. In my suggestion I was
> > aiming for maximum possible clarity and lack of crud.
> That, and I'm very interested to know how you managed to get a space
> character into a function name! ;)
Now that's easy:
>>> def test() :
... print "hello"
>>> x = new.function (test.func_code, globals (), "'case a'")
<function 'case a' at 0x822ae24>
Christian Tanzer tanzer at swing.co.at
Glasauergasse 32 Tel: +43 1 876 62 36
A-1130 Vienna, Austria Fax: +43 1 877 66 92
More information about the Python-list