Re: Securing a future for anonymous functions in Python
Okay, I tried to post this previously but ran into the new Google groups system which appears to have sent my original response into the ether... Oops. Trying again. Alan Gauld wrote: > On Thu, 30 Dec 2004 23:28:46 +1000, Nick Coghlan > <[EMAIL PROTECTED]> wrote: > > > GvR has commented that he want to get rid of the lambda keyword for Python 3.0. > > Getting rid of lambda seems like a worthy goal, > > Can I ask what the objection to lambda is? > 1) Is it the syntax? > 2) Is it the limitation to a single expression? > 3) Is it the word itself? > > I can sympathise with 1 and 2 but the 3rd seems strange since a > lambda is a well defined name for an anonymous function used in > several programming languages and originating in lambda calculus > in math. Lambda therefore seems like a pefectly good name to > choose. > > So why not retain the name lambda but extend or change the syntax > to make it more capable rather than invent a wholly new syntax > for lambdas? > > Slightly confused, but since I only have time to read these > groups regularly when I'm at home I have probably missed the bulk > of the discussion over the years. > > Alan G. > Author of the Learn to Program website > http://www.freenetpages.co.uk/hp/alan.gauld Hi Alan: Having taken some calculus (derivatives, limits, some integrals) but never even heard of lambda calculus, to me, lambda means absolutely NOTHING. Less than nothing. Actually, in my encounters with others code in Python (including reading near 1000 recipes for the recent edition of the Cookbook), what I've discovered is that what lambda mostly means to me is: "I don't wanna write clear, elegant Python - I wanna write fancy, clever, obfuscated code, and lambda lets me do that!" I've seen maybe 1 case in 10 where lambda appears, to me, to allow clearer, cleaner code than defining a function. Most cases-it's an ugly, incomprehensible hack. So, if people really need anonymous functions in Python (and apparently, they do), then at least lets get a word that actually *means* something. Every other word in Python has an obvious meaning. lambda doesn't. So, I guess I don't like the word itself - any more than I like how it's (mostly) used. Anna Martelli Ravenscroft -- http://mail.python.org/mailman/listinfo/python-list
Re: Securing a future for anonymous functions in Python
Jacek Generowicz wrote: > "Anna" <[EMAIL PROTECTED]> writes: > > > Having taken some calculus (derivatives, limits, some integrals) but > > never even heard of lambda calculus, to me, lambda means absolutely > > NOTHING. Less than nothing. > > And before you took calculus, the chances are that derivatives, limits > and integrals meant less than nothing to you. > > But now, I am quite sure, you know that in Python lambda is a keyword > which creates anonymous functions. Now that you know what lambda does, > what's the problem with it? (It certainly doesn't mean "Less than > nothing" to you now.) > > > So, I guess I don't like the word itself > > Fair enough. I guess there are people out there who might have a > distaste for the word "class" or "def" or any of the other words which > are keywords in Python. > > > Every other word in Python has an obvious meaning. lambda doesn't. > > Obvious to whom? > > The meaning of every word is obvious, once you have been taught it; > and a complete mystery if you have not. > > What do you make of "seq[2:-2]"? It means "less than nothing" to the > uninitiated. Just like lambda. Actually - whether or not I understood the [2:-2] notation, knowing nothing else, the "seq" would clue me in that we're probably doing something with sequences... Personally, I like lambdas less than regular expressions (of which I'm particularly UNfond but understand their usefulness at times). At least with regular expressions - I know that the gibberish I need to decipher (probably) has to do with text parsing... With class and def, I at least have a *name* to start with - class Square pretty obviously is going to have something to do with geometric shapes, I would hope (or maybe with boring people...). def getfoo() tells me I'm the function is likely to go elsewhere and get something. It's a *start*, a handle, to deciphering whatever the following statements are doing. (Yes, I realize that often class and function names suck - but more often than not, they give *some* clue). Whereas, with lambda - I have *nothing* to go on. With lambdas, all I know is that the programmer wanted to hide whatever it is the program is doing behind the curtain... (at least that's the way it comes across). So, not only is the word itself not descriptive of anything to me - even knowing that it means "anonymous function" - the use of it precludes descriptiveness, as compared to defining a function. IMHO, YMMV, etc etc Anna -- http://mail.python.org/mailman/listinfo/python-list
Re: Securing a future for anonymous functions in Python
Jacek Generowicz wrote: > "Anna" <[EMAIL PROTECTED]> writes: > > > With class and def, I at least have a *name* to start with - class > > Square pretty obviously is going to have something to do with > > geometric shapes, I would hope (or maybe with boring people...). > > Or maybe with multiplying something by itself. Or maybe the author > made some changes in his program, and forgot to rename the class > sensibly, and the class' functionality has nothing to do with squares > of any sort any more. Or maybe he felt the name "Square" was very > appropriate for something else in his program and inadvertently gave > the same name to two different entities thereby clobbering the one > whose use was intended at this point. Idjits abound. ;-) Can't make anything foolproof because fools are so ingenious. > > Whereas, with lambda - I have *nothing* to go on. > > Aaah. OK, you object to lambda because it gives you no clue as to what > the function does, rather than with the word "lambda" itself? Is that > it? > > So, IIUC, you consider > >def add_one(x): >return x+1 > >map(add_one, seq) > > to be clearer than > >map(lambda x:x+1, seq) Completely, totally, and unambiguously: the version with the defined function is immediately clear to me; the version with the lambda is decipherable, but requires deciphering (even at 2nd and 3rd glance). But first, wouldn't something like: [x+1 for x in seq] be even clearer? Given an example more complex (which you must admit, lambdas usually are) - the name of the function is something my brain can hold on to to represent the group of operations; where with the lambda, I need to mentally go through each operation each time I try to read it. And the more complex f is, the harder time I have holding it all in my head while I figure out how to get from the beginning value x to the ending value f(x). lambda is an O(N*N) problem for my brain. I could see someone more mathematically-minded being happier with lambda. It's not, after all, the word "lambda" itself; I would still have some issues with using, say "function", instead of "lambda", but at least then I would immediately know what I was looking at... Anna -- http://mail.python.org/mailman/listinfo/python-list
Re: Statement local namespaces summary (was Re: python3: 'where' keyword)
+1 I really like the idea of this. It removes all my objections to lambdas, and replaces it with something clear and readable. I look forward to seeing what comes of it. Anna -- http://mail.python.org/mailman/listinfo/python-list
Re: Securing a future for anonymous functions in Python
Same here. -- http://mail.python.org/mailman/listinfo/python-list
Re: Securing a future for anonymous functions in Python
You cut something from that... """It's not, after all, the word "lambda" itself; I would still have some issues with using, say "function", instead of "lambda", but at least then I would immediately know what I was looking at...""" I would have fewer ambiguities about using, say "func" rather than lambda. Lambda always makes me feel like I'm switching to some *other* language (specifically, Greek - I took a couple of semesters of Attic Greek in college and quite enjoyed it.) But, the fact that lambda doesn't MEAN anything (and has come - I mean - DELTA at least has a fairly commonly understood meaning, even at high-school level math. But, lambda? If it was "func" or "function" or even "def", I would be happier. At least that way I'd have some idea what it was supposed to be... BTW - I am *quite* happy with the proposal for "where:" syntax - I think it handles the problems I have with lambda quite handily. Anna -- http://mail.python.org/mailman/listinfo/python-list
hello
The message cannot be represented in 7-bit ASCII encoding and has been sent as a binary attachment. -- http://mail.python.org/mailman/listinfo/python-list
Re: python.org is down?
On Jul 24, 2011 2:43 AM, "Laszlo Nagy" wrote: > > Can it be a problem on my side? I have tried from several different computers. I cannot even ping it. Looks like it is down for everyone according to this site: http://www.downforeveryoneorjustme.com/ . Anna http://annavester.com -- http://mail.python.org/mailman/listinfo/python-list
global name not defined :$
Hi I am trying to write a red-black tree implementation in python. I am very new to python and appologize if my question is terribly stubid. But I ran into some trouble. I have a class and in it there are functions but when I try to run the code I have I just get an error on one of the functions “global name ‘balancedFourNode’ is not defined” Now of course I realize that I am doing something wrong when defining the function but I just can’t seem to find it. Any insight would be greatly appreciated. Another thing, I’ll just put in a code snip but I am not sure if it is enough for you guys to see the problem, how ever the class is almost 200 lines so I just didn’t want to put it all in the post. Many thanks, Anna M. class node: def __init__(self,g=None): self.data=""> self.parent=None self.child=[None,None] # color 0 = black, 1 = red self.color = 0 # NB. changed june 7th # Kids were two and named right and left, respectively # Now a node can have many children # used in 2-3-4 trees and other fun trees. def left(self,x): self.child[0]=x x.parent=self return self def right(self,x): self.child[1]=x x.f=self return self def b(self,l): self.child=l[:] for child in l: child.f=self return self def noOfKids(self): kids = 0 if self.child[0] != None: kids += 1 if self.child[1] != None: kids += 1 return kids def balancedFourNode(self): children = 0 children = noOfKids(self) if children == 2: if child[0].color == 1: red += 1 if child[1].color == 1: red += 1 if red == 2: return 1 else: return 0 -- http://mail.python.org/mailman/listinfo/python-list
Re: Extended Call for Proposals for Presentations and Tutorials at PyCon SG 2013
Just a followup - Alex Martelli and I attended PyCon SG 2012 and it was a wonderful experience. I highly encourage folks to consider submitting a proposal to this conference. It's a worthwhile conference and a chance to visit a fascinating place. cordially, Anna On Fri, Mar 29, 2013 at 5:55 AM, George Goh wrote: > Hi, > > On behalf of the organizing committee of PyCon SG 2013, we are > announcing our Extended Call for Proposals for Presentations and > Tutorials for the 2013 PyCon Singapore Conference, to be held in > Singapore from June 13 to 15, 2013. > > We are pleased to announce that our keynote speaker is Wes McKinney, > main developer of pandas (http://pandas.pydata.org/) and author of the > new book "Python for Data Analysis". > > To submit your proposal(s) for presentations and/or tutorials, please > refer to the details found at https://pycon.sg/proposals/ > > The submission deadlines for both have been extended to April 30, 2013 > > For enquiries, pls direct them to conference at > pycon.sg<mailto:conference at pycon.sg> > > We look forward to receiving your proposals! And to a great conference > this year. > > Best regards, > George Goh > On behalf of the PyCon SG 2013 Organizing Committee > -- > http://mail.python.org/mailman/listinfo/python-announce-list > > Support the Python Software Foundation: > http://www.python.org/psf/donations/ -- cordially, Anna -- http://mail.python.org/mailman/listinfo/python-list
Re: PSF Infrastructure has chosen Roundup as the issue tracker for Python development
On 10/20/06, Brett Cannon <[EMAIL PROTECTED]> wrote: > At the beginning of the month the PSF Infrastructure committee announced > that we had reached the decision that JIRA was our recommendation for the > next issue tracker for Python development. Realizing, though, that it was a > tough call between JIRA and Roundup we said that we would be willing to > switch our recommendation to Roundup if enough volunteers stepped forward to > help administer the tracker, thus negating Atlassian's offer of free managed > hosting. > > Well, the community stepped up to the challenge and we got plenty of > volunteers! In fact, the call for volunteers has led to an offer for > professional hosting for Roundup from Upfront Systems. The committee is > currently evaluating that offer and will hopefully have a decision made > soon. Once a decision has been made we will contact the volunteers as to > whom we have selected to help administer the installation (regardless of who > hosts the tracker). The administrators and python-dev can then begin > working towards deciding what we want from the tracker and its > configuration. > > Once again, thanks to the volunteers for stepping forward to make this > happen! > > -Brett Cannon > PSF Infrastructure committee chairman Interestingly enough, the quote of the day from Google on this email was: Never doubt that a small group of thoughtful, committed citizens can change the world; indeed, it's the only thing that ever has. Margaret Mead It just seems highly appropriate. I'm very glad we decided to go with Roundup. I've been impressed with its usability when I've had the opportunity to use it. -- cordially, Anna -- It is fate, but call it Italy if it pleases you, Vicar! -- http://mail.python.org/mailman/listinfo/python-list
Tabnanny?
Hello, i am very new to this. Only heard of python a week ago and have never posted before anywhere. But I am trying to rewrite a program that I made in C++ in Python, a radixSort I did as a school project. I get a Tabnanny Tokenizing Error that says Token Error: EOF in multi-line statement. I gather from the internet that it means I have a tab-error. I just can’t seem to find it. Is this something you can help me with? Could I post my code here and you could look at it or is that a bit to much ;) Many thanks, Anna -- http://mail.python.org/mailman/listinfo/python-list
RE: Tabnanny?
Thank you so much and so it goes . . . from random import randint def idxLargest(list, n): idxMx = 0 for i in range(1, n, 1): if list[i] > list[idxMx]: idxMx = i return idxMx def radixSort(data): sorting = [data] tmp = [] for i in range(10): tmp.append([]) idx = idxLargest(data, len(data) max = data[idx] passes = len(max) + 1 for i in range(1, passes + 1, 1): sorter = tmp for bucket in sorting: for next in bucket: nr = next%(10**i) radix = (nr/10**(i-1)) sorter[radix].append(next) sorting = sorter return sorting n = 10 a = 0 b = 200 test = [] for i in range(n): test.append(randint(a,b)) print test test = radixsort(test) print test >Hi Anna ! > >Please post your code, so we can take a look to see what is happening. > >See ya ! > >Em Quarta 08 Junho 2005 23:36, Anna M. escreveu: >> Hello, i am very new to this. Only heard of python a week ago and have >> never posted before anywhere. But I am trying to rewrite a program that >I >> made in C++ in Python, a radixSort I did as a school project. I get a >> Tabnanny Tokenizing Error that says Token Error: EOF in multi-line >> statement. I gather from the internet that it means I have a tab-error. >I >> just can't seem to find it. Is this something you can help me with? >Could >> I post my code here and you could look at it or is that a bit to much ;) >> >> Many thanks, >> >> Anna -- Douglas Soares de Andrade http://douglasandrade.cjb.net - dsa at unilestemg.br UnilesteMG - www.unilestemg.br ICQ, MSN = 76277921, douglas at tuxfamily.org -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Game Programming Clinic and Online Gaming at PyCon
On 2/17/07, Jeff Rush <[EMAIL PROTECTED]> wrote: At PyCon this year we're going to have a multi-day game programming clinic and challenge. This is a first-time event and an experiment to find those in the Python community who enjoy playing and creating games. Python has several powerful modules for the creation of games among which are PyGame and PyOpenGL. On Friday evening, Phil Hassey will give an introduction to his game Galcon, an awesome high-paced multi-player galactic action-strategy game. You send swarms of ships from planet to planet to take over the galaxy. Phil will be handing out free limited-time licenses to those present. He will also be glad to talk about the development of Galcon using PyGame. After the Friday PSF Members meeting lets out around 8:40pm, Richard Jones will give his 30-60 minute introduction to the PyGame framework so you too can get started writing games. Wonderful. Thanks for the heads-up! I look forward to this. On Saturday evening, Lucio Torre and Alejandro J. Cura, who have come from Argentina to give the talk "pyweek: making games in 7 days" Friday afternoon, will help people develop their games in the clinic room with mini-talks on various game technologies. Ah - that's a really fun presentation - I saw it at CafeConf. Glad to hear they'll be helping folks on Satyrday night. Thanks for all the links Jeff. Very helpful. -- cordially, Anna -- It is fate, but call it Italy if it pleases you, Vicar! -- http://mail.python.org/mailman/listinfo/python-list
Announcing edupython list
In order to facilitate small groups working on specific Python-in-Education projects, we have launched an edupython list on google groups(http://groups.google.com/group/edupython or [EMAIL PROTECTED]). We envision participation by people trying to coordinate work on the nuts and bolts implementation of a project, with frequent progress reports and requests for suggestions and comments coming back to edu-sig. The list developed as a result of a quite well-attended and enthusiastic BOF meeting at PyCon. This edupython list is not intended to replace edu-sig, which remains very strong for theoretical and philosophical discussions, and for getting input and suggestions from a wider group, but is also necessarily higher bandwidth. We invite anyone working on Python-related education projects to join the list. Cordially,Anna Martelli Ravenscroft -- http://mail.python.org/mailman/listinfo/python-list
Doing it Wrong: python-ldap and delete operations using ldifWriter
I want to do (what I thought) would be quite a simple thing. I have an LDAP entry that looks like this(in LDIF format): dn: cn=myorg,ou=teams,ou=groups,o=company,c=us cn: myorg objectClass: top objectClass: CompanyTeams objectClass: groupOfUniqueNames owner: cn=john,ou=people,o=company,c=us uniqueMember: cn=bob,ou=people,o=company,c=us uniqueMember: cn=bill,ou=people,o=company,c=us uniqueMember: cn=carol,ou=people,o=company,c=us uniqueMember: cn=frank,ou=people,o=company,c=us uniqueMember: cn=alice,ou=people,o=company,c=us In my code, I have all these entries represented as dicts. I'm using Python's LDIF writer to write these entries out to proper LDIF. Exporting the whole thing is easy: def dump_ldif(self): writer = LDIFWriter(open('entrybackup.ldif', 'wb')) writer.unparse(cn=myorg, self.all_the_teams.get_teamstr_by_name('{'objectClass': ['top', 'CompanyTeams', 'groupOfUniqueNames']'owner': ['cn=john,ou=people,o=company,c=us'], 'uniqueMember': ['uniqueMember: cn=bob,ou=people,o=company,c=us','uniqueMember: cn=bill,ou=people,o=company,c=us','uniqueMember: cn=carol,ou=people,o=company,c=us','uniqueMember: cn=frank,ou=people,o=company,c=us','uniqueMember: cn=alice,ou=people,o=company,c=us'], 'cn': ['myorg']}') But how do you have LDIF output that uses delete/modify operators? I have a list of uniqueMember that I want to go away: ['cn=bob,ou=people,o=company,c=us', 'cn=bill,ou=people,o=company,c=us'] And (I believe) this is the end goal in LDIF format, pulling from my list: dn: cn=myorg,ou=teams,ou=groups,o=company,c=us changetype: modify delete: uniqueMember uniqueMember: cn=bob,ou=people,o=company,c=us uniqueMember: cn=bill,ou=people,o=company,c=us Is there not some simple way to do this with Python(2.7)? Starting to feel crazy. Note: I could just do the text output/manipulation, but I want to stick with LDIFWriter to write this output. I just want find the syntax to output 'delete' LDIF directives. -- https://mail.python.org/mailman/listinfo/python-list
Not able to get utf8 encoded string into a document
Hi all, This is my first post and I'm really at a loss for how to fix my problem, so I really hope someone can help me out. I am working on a web application using Pylons .0.9.6, SQLAlchemy 0.4.4, MySQLdb 1.2.2 and Python 2.4.4. We want to use utf8 encoding throughout and as far as I can see everything is set properly between components and I've got a sitecustomize.py in my site-packages directory of python set to utf8 as well. Everything is stored properly in the database and displays nicely in the app. However, when I try to take a string that is coming out of the database and export it to a Word document, no amount of encoding/decoding will make the Word doc display properly. Since I'm on a Windows machine, my default locale is cp437. Is this the reason? Is there something that needs to be set that I'm missing? Any help would be greatly appreciated. Thanks, Anna -- http://mail.python.org/mailman/listinfo/python-list
ANN: repology-client library to access Repology API
Hi newsgroup, I needed to fetch Repology data for my pet project and now it's a library: https://pypi.org/project/repology-client/ It uses aiohttp, if that matters. Feel free to use and contribute. -- https://mail.python.org/mailman/listinfo/python-list