473,320 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Lamdba forms

hi all, I am a python newbie. why functions created with lambda forms
cannot contain statements?
how to get unnamed function with statements?

Apr 20 '06 #1
8 1067

<ls*******@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
hi all, I am a python newbie. why functions created with lambda forms
cannot contain statements?
Because statement do not fit in expressions.
how to get unnamed function with statements?


Can't.

Many discussions in archives (which Google has).

tjr

Apr 20 '06 #2
To expand on the above, Python does not have statements in its lambda
forms, but that does not stop pythoneers from getting the job done.

I use a named function for that, but if you have an issue with that, it
really is worth following Terry's advice as the subject has been
tackled at great length before.

- Cheers, Paddy.

Apr 20 '06 #3
Ant
Why does the function have to be unnamed? you can easly nest function
definitions and refer to them. IIRC the lambda form is probably going
to be removed at some point, as it is not needed:

def outerfn():
dostuff()
def inner(x,y):
out = (x^y)
print out
return out

my_local_function = inner
my_local_function(3,4)

outerfn()

Apr 20 '06 #4
Ant wrote:
IIRC the lambda form is probably going
to be removed at some point, as it is not needed:


You remember incorrectly.
Apr 20 '06 #5
Ant
No, I remembered correctly:
http://www.artima.com/weblogs/viewpost.jsp?thread=98196
but probably not until Python 3.0.

Apr 20 '06 #6
"Ant" wrote:
No, I remembered correctly:
http://www.artima.com/weblogs/viewpost.jsp?thread=98196
but probably not until Python 3.0.


however,

http://mail.python.org/pipermail/pyt...ry/060415.html

(one would have thought that someone might have added a note to
the comments of the first post, but the most recent contributor to
that thread is a mortgage spammer...)

</F>

Apr 20 '06 #7
Ant
Fair enough. I've just found this as well, which implies that lambda
isn't being killed off in 3.0:

http://www.python.org/dev/peps/pep-3100/

In particular:
"Lambdas will have to be parenthesized [23]"

Apr 20 '06 #8
Ant wrote:
Fair enough. I've just found this as well, which implies that lambda
isn't being killed off in 3.0:

http://www.python.org/dev/peps/pep-3100/

In particular:
"Lambdas will have to be parenthesized [23]"


Also: http://www.python.org/doc/essays/ppt...6/Py3kACCU.ppt
slide 14.
Apr 22 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
3
by: Joshua Russell | last post by:
Hi, Both the methods below open up a windows form called MasterForm. However, one works better than the other. Method 1 opens the form correctly but I don't have any reference to the instance of...
7
by: Mike Bulava | last post by:
I have created a base form that I plan to use throughout my application let call the form form1. I have Built the project then add another form that inherits from form1, I add a few panel controls...
13
by: MD | last post by:
I have been converting a program from VB6 to VB.Net and enhancing it as well. All has been progressing OK although its been hard work. Now, all of a sudden, when I try to execute a ShowDialog()...
15
by: Joshua Kendall | last post by:
I have a script in which it keeps opening the same form instead of only one instance. I also need help with a form that has a password. Where do I put the actual password? can I use a database for...
3
by: Lloyd Sheen | last post by:
I have the following situation: Need a user resizable user control. After much trying with user control I came across the idea of hosting the controls in a form marked as not TopLevel = false. ...
8
by: Stephen Rice | last post by:
Hi, I have a periodic problem which I am having a real time trying to sort. Background: An MDI VB app with a DB on SQL 2000. I have wrapped all the DB access into an object which spawns a...
3
by: Geraldine Hobley | last post by:
Hello, In my project I am inheriting several forms. However when I inherit from a form and add additional subroutines and methods to my inherited form I get all sorts of problems. e.g. I sometimes...
6
by: dbuchanan | last post by:
I have a Windows Forms application that accesses SQL Server 2k from a small local network. The application has been used for weeks on other systmes but a new install on a new machine retruns...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.