Statespressions? (Re: Draft Pep (was: Re: Let's Talk About Lambda Functions!))
Greg Ewing
see_reply_address at something.invalid
Mon Aug 5 22:18:13 EDT 2002
Huaiyu Zhu wrote:
> This leads to
> inconsistent styles like
>
> def func1 ...
> def func3 ...
> def func4 ...
>
> callbacks = {
> "case a": func1,
> "case b": lambda ...
> "case c": func3,
> "case d": func4,
> "case e": lambda ...
> }
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"():
...
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
More information about the Python-list
mailing list