Statespressions? (Re: Draft Pep (was: Re: Let's Talk About Lambda Functions!))

Jonathan Hogg jonathan at onegoodidea.com
Tue Aug 6 04:58:23 EDT 2002


On 6/8/2002 5:11, in article K%H39.4832$7n5.2407 at sccrnsc01, "Emile van
Sebille" <emile at fenx.com> wrote:

> Greg Ewing
>> Applying some wild lateral thinking here, maybe what we
>> want is not a way of writing def statements in the middle
>> of expressions, but a way of writing expressions that
>> allows them to include statements.
>> 
>> Suppose you could write something like
>> 
>>    dict callbacks:
>> 
>>      def "case a"():
>>        ...
>> 
>>      def "case b"():
>>        ...
>> 
>>      def "case c"():
>>        ...
>> 
> 
> Supposing you can, and continuing laterally off the page...
> 
> Except for the dict and implied indent level, isn't this a module?
> 
> import callbacks
> callbacks = callbacks.__dict__
> callbacks['case a']

I thought it was a class... ;-)

Jonathan




More information about the Python-list mailing list