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

Emile van Sebille emile at fenx.com
Tue Aug 6 00:11:22 EDT 2002


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']

 
--

Emile van Sebille
emile at fenx.com

---------




More information about the Python-list mailing list