On 12 Jul 2005 08:28:45 -0700
Devan L [EMAIL PROTECTED] wrote:
[ here's some context:
I've been playing with a function that creates an anonymous function by
compiling a string parameter, and it seems to work pretty well:
def fn( text):
exec 'def foo' + text.strip()
I've been playing with a function that creates an anonymous function by
compiling a string parameter, and it seems to work pretty well:
def fn( text):
exec 'def foo' + text.strip()
return foo
This can be used like:
def foo( x):
print x( 2, 5)
foo( fn( '''
How is this different from a nested function?
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 12 Jul 2005 08:28:45 -0700, Devan L wrote:
How is this different from a nested function?
Well, this is a newsgroup posting written by you. Nested functions in
Python are callable objects that exist as attributes of other callable
objects, so the two are very different.
Alternatively,
Well, the string that gets passed is more or less a function
definition, which is then called with exec. I don't see why you'd need
to write a string out with the function definition and then call it.
You could just write the function.
As for the nested functions, I had been presuming that it was
Devan L wrote:
Well, the string that gets passed is more or less a function
definition, which is then called with exec. I don't see why you'd need
to write a string out with the function definition and then call it.
You could just write the function.
As for the nested functions, I had been
You missed Steven's point which is to quote the message to which you are
replying. Not everyone is reading this list in a conveniently threaded
form, so you need to provide some context for them to be able to follow
along.
Ah, sorry, I didn't quite get what he was referring to.
--
Robert Kern wrote:
Not everyone is reading this list in a conveniently threaded
form
Why not? Just about every modern newsgroup reader and e-mail app has a
threaded view option.
--
http://mail.python.org/mailman/listinfo/python-list
Joseph Garvin wrote:
Robert Kern wrote:
Not everyone is reading this list in a conveniently threaded form
Why not? Just about every modern newsgroup reader and e-mail app has a
threaded view option.
My newsreader supports threading, but the first message I see in this
thread is from
Joseph Garvin wrote:
Robert Kern wrote:
Not everyone is reading this list in a conveniently threaded
form
Why not? Just about every modern newsgroup reader and e-mail app has a
threaded view option.
Good point. Allow me to modify my statement: not all newsreaders/email
apps thread
On Tue, 12 Jul 2005 17:17:46 -0600, Joseph Garvin wrote:
Robert Kern wrote:
Not everyone is reading this list in a conveniently threaded
form
Why not? Just about every modern newsgroup reader and e-mail app has a
threaded view option.
Technology as a substitute for manners is it?
I
11 matches
Mail list logo