From cbc at unc.edu Wed Oct 1 19:51:24 2008 From: cbc at unc.edu (Chris Calloway) Date: Wed, 01 Oct 2008 13:51:24 -0400 Subject: [PyAR2] python.org Publicity for PyAR2 Conference Message-ID: <48E3B89C.5070305@unc.edu> You guys need to pimp your event on the front page of python.org in the same way the Texas Python Regional Unconference has. -- Sincerely, Chris Calloway http://www.secoora.org office: 332 Chapman Hall phone: (919) 599-3530 mail: Campus Box #3300, UNC-CH, Chapel Hill, NC 27599 From Chad_Cooper at SWN.COM Wed Oct 1 20:01:49 2008 From: Chad_Cooper at SWN.COM (Chad Cooper) Date: Wed, 1 Oct 2008 13:01:49 -0500 Subject: [PyAR2] python.org Publicity for PyAR2 Conference In-Reply-To: <48E3B89C.5070305@unc.edu> References: <48E3B89C.5070305@unc.edu> Message-ID: Chris, you are totally right! Jeff, how would we go about getting that done?? chad > -----Original Message----- > From: pyar2-bounces+supercooper=gmail.com at python.org > [mailto:pyar2-bounces+supercooper=gmail.com at python.org] On > Behalf Of Chris Calloway > Sent: Wednesday, October 01, 2008 12:51 PM > To: pyar2 > Subject: [PyAR2] python.org Publicity for PyAR2 Conference > > You guys need to pimp your event on the front page of > python.org in the same way the Texas Python Regional Unconference has. > > -- > Sincerely, > > Chris Calloway > http://www.secoora.org > office: 332 Chapman Hall phone: (919) 599-3530 > mail: Campus Box #3300, UNC-CH, Chapel Hill, NC 27599 > > > > _______________________________________________ > PyAR2 mailing list > PyAR2 at python.org > http://mail.python.org/mailman/listinfo/pyar2 > > Notice: This e-mail may contain privileged and/or confidential information and is intended only for the addressee. If you are not the addressee or the person responsible for delivering it to the addressee, you may not copy or distribute this communication to anyone else. If you received this communication in error, please notify us immediately by telephone or return e-mail and promptly delete the original message from your system. From pythonlarry at gmail.com Fri Oct 3 16:58:19 2008 From: pythonlarry at gmail.com (Larz Luvchik) Date: Fri, 3 Oct 2008 09:58:19 -0500 Subject: [PyAR2] Carpooling, anyone - from Hot Springs to pyArkansas? Message-ID: (I tried sending this last night, but didn't seem to go through... Sorry!) Greetings, all. I would like to attend pyArkansas, and have a couple of options: [1] I have a large old-school Suburban that seats "7", as I do have the 3rd row seat, but this is of course more cramped, and the back is much more comfortable with only two. So, room for 3 very comfortably, 4-5 snugly. Oh, yeah, I have a Mitsubishi 40" TV in the back I'd really help/need to move out of the back to use the 3rd row, too... :> With gas prices and the fact that this baby doesn't get the best mileage, a few bucks toward gas would be appreciated. [2] If anyone else is going from this area and would be willing, I'd happily ride up with you. And even more happily chip in for gas as well, of course. :) *I* plan/want to stay for the entire day, 8a until ~4p; Google maps has it at about 1.5 hours drive time each way, so that's leaving ~6a to go up, getting back (assuming no staying in town to kibitz) about 5:30/6p. Just thought I'd throw this out into the ether... Cheers, and I hope to get some response(s)! -Larry _________________________________________________________________ Stay up to date on your PC, the Web, and your mobile phone with Windows Live. http://clk.atdmt.com/MRT/go/msnnkwxp1020093185mrt/direct/01/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From pythonlarry at gmail.com Fri Oct 3 17:04:39 2008 From: pythonlarry at gmail.com (Larz Luvchik) Date: Fri, 3 Oct 2008 10:04:39 -0500 Subject: [PyAR2] Ride from Hot Springs Area? Message-ID: (I tried sending this last night, but didn't seem to go through... I also tried to send this from a different server. I can't see that it's gotten through, so I'm sending it again with a different subject. If duplicates show up, sorry! :) Greetings, all. I would like to attend pyArkansas, and have a couple of options: [1] I have a large old-school Suburban that seats "7", as I do have the 3rd row seat, but this is of course more cramped, and the back is much more comfortable with only two. So, room for 3 very comfortably, 4-5 snugly. Oh, yeah, I have a Mitsubishi 40" TV in the back I'd really help/need to move out of the back to use the 3rd row, too... :> With gas prices and the fact that this baby doesn't get the best mileage, a few bucks toward gas would be appreciated. [2] If anyone else is going from this area and would be willing, I'd happily ride up with you. And even more happily chip in for gas as well, of course. :) *I* plan/want to stay for the entire day, 8a until ~4p; Google maps has it at about 1.5 hours drive time each way, so that's leaving ~6a to go up, getting back (assuming no staying in town to kibitz) about 5:30/6p. Just thought I'd throw this out into the ether... Cheers, and I hope to get some response(s)! -Larry _________________________________________________________________ See how Windows connects the people, information, and fun that are part of your life. http://clk.atdmt.com/MRT/go/msnnkwxp1020093175mrt/direct/01/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From pythonlarry at gmail.com Fri Oct 3 05:09:16 2008 From: pythonlarry at gmail.com (Larry Hale) Date: Thu, 2 Oct 2008 22:09:16 -0500 Subject: [PyAR2] Carpooling, anyone - from Hot Springs to pyArkansas? Message-ID: <2b9469390810022009p2c34891fpa66ff2bcefd9d6cb@mail.gmail.com> Greetings, all. I would like to attend pyArkansas, and have a couple of options: [1] I have a large old-school Suburban that seats "7", as I do have the 3rd row seat, but this is of course more cramped, and the back is much more comfortable with only two. So, room for 3 very comfortably, 4-5 snugly. Oh, yeah, I have a Mitsubishi 40" TV in the back I'd really help/need to move out of the back to use the 3rd row, too... :> With gas prices and the fact that this baby doesn't get the best mileage, a few bucks toward gas would be appreciated. [2] If anyone else is going from this area and would be willing, I'd happily ride up with you. And even more happily chip in for gas as well, of course. :) *I* plan/want to stay for the entire day, 8a until ~4p; Google maps has it at about 1.5 hours drive time each way, so that's leaving ~6a to go up, getting back (assuming no staying in town to kibitz) about 5:30/6p. Just thought I'd throw this out into the ether... Cheers, and I hope to get some response(s)! -Larry -------------- next part -------------- An HTML attachment was scrubbed... URL: From noah.gift at gmail.com Tue Oct 7 00:18:25 2008 From: noah.gift at gmail.com (Noah Gift) Date: Mon, 6 Oct 2008 18:18:25 -0400 Subject: [PyAR2] Thank you for the hospitality Message-ID: Greg, Chad, and all, Thanks for the hospitality during my visit, I had a fun time with the gang. For everyone that received a book, if you get a chance to write an honest review I would appreciate it. I will be doing a blog entry this week for O'Reilly about the whole PyArkansas experience, and recommend it. -- Noah Gift http://noahgift.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From supercooper at gmail.com Tue Oct 7 13:41:12 2008 From: supercooper at gmail.com (Chad Cooper) Date: Tue, 7 Oct 2008 06:41:12 -0500 Subject: [PyAR2] Thank you for the hospitality In-Reply-To: References: Message-ID: <8398c3a60810070441o33cc92ardf78d99f5dbb9b9c@mail.gmail.com> Noah, glad you had a good time, and I hope you found some good barbque on your way back home. Thanks for taking time out to come help us out and give your talks - I know I learned ALOT on Saturday. Best wishes for you and your family with your upcoming big move. chad! On Mon, Oct 6, 2008 at 5:18 PM, Noah Gift wrote: > Greg, Chad, and all, > Thanks for the hospitality during my visit, I had a fun time with the gang. > For everyone that received a book, if you get a chance to write an honest > review I would appreciate it. I will be doing a blog entry this week for > O'Reilly about the whole PyArkansas experience, and recommend it. > > -- > Noah Gift > http://noahgift.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From srilyk at gmail.com Tue Oct 7 14:43:21 2008 From: srilyk at gmail.com (W W) Date: Tue, 7 Oct 2008 07:43:21 -0500 Subject: [PyAR2] Thank you for the hospitality In-Reply-To: <8398c3a60810070441o33cc92ardf78d99f5dbb9b9c@mail.gmail.com> References: <8398c3a60810070441o33cc92ardf78d99f5dbb9b9c@mail.gmail.com> Message-ID: <333efb450810070543p2ab2b30bka6621a2c92b97db4@mail.gmail.com> I second that thanks and wishes! As well as learning a lot! I'm currently working my way through the book, and I plan on writing up a review for it! So far I've only made it through the introduction and I hated to put it down... but I have a test this morning in Cal I... It was great meeting you, too! -Wayne On Tue, Oct 7, 2008 at 6:41 AM, Chad Cooper wrote: > Noah, glad you had a good time, and I hope you found some good barbque on > your way back home. Thanks for taking time out to come help us out and give > your talks - I know I learned ALOT on Saturday. Best wishes for you and your > family with your upcoming big move. > > chad! > > > > > On Mon, Oct 6, 2008 at 5:18 PM, Noah Gift wrote: > >> Greg, Chad, and all, >> Thanks for the hospitality during my visit, I had a fun time with the >> gang. For everyone that received a book, if you get a chance to write an >> honest review I would appreciate it. I will be doing a blog entry this week >> for O'Reilly about the whole PyArkansas experience, and recommend it. >> >> -- >> Noah Gift >> http://noahgift.com >> > > > _______________________________________________ > PyAR2 mailing list > PyAR2 at python.org > http://mail.python.org/mailman/listinfo/pyar2 > > -- To be considered stupid and to be told so is more painful than being called gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness, every vice, has found its defenders, its rhetoric, its ennoblement and exaltation, but stupidity hasn't. - Primo Levi -------------- next part -------------- An HTML attachment was scrubbed... URL: From gslindstrom at gmail.com Tue Oct 7 17:25:10 2008 From: gslindstrom at gmail.com (Greg Lindstrom) Date: Tue, 7 Oct 2008 10:25:10 -0500 Subject: [PyAR2] Thank you for the hospitality In-Reply-To: <333efb450810070543p2ab2b30bka6621a2c92b97db4@mail.gmail.com> References: <8398c3a60810070441o33cc92ardf78d99f5dbb9b9c@mail.gmail.com> <333efb450810070543p2ab2b30bka6621a2c92b97db4@mail.gmail.com> Message-ID: > On Mon, Oct 6, 2008 at 5:18 PM, Noah Gift wrote: >> >>> Greg, Chad, and all, >>> Thanks for the hospitality during my visit, I had a fun time with the >>> gang. For everyone that received a book, if you get a chance to write an >>> honest review I would appreciate it. I will be doing a blog entry this week >>> for O'Reilly about the whole PyArkansas experience, and recommend it. >>> >>> -- >>> Noah Gift >>> http://noahgift.com >>> >> Noah, Thanks for your time and expertise. Being somewhat isolated from large population centers, we don't often get the chance to have anyone at your level come work with us. It was a real treat to bring you in and I hope you are the first of many to visit Arkansas. I will be writing a review of your book in the next week of so and getting it to Marsee. I just went through it again; we have plans to use many of the techniques outlined in the book to create a "real-time" backup system, automated auditing routines using Pyro and pyINotify, and many others. My boss, Scott Shellabarger (VP of IT) is really fired up about the possibilities, which makes the Senior Staff at Novasys Health pleased with the $300.00 they donated to the effort. The comments on your System Admin class were overwhelmingly positive. I was pleased to see so many "experienced" people there asking questions. The one negative comment dealt with you not giving a "formal" class; they wanted slides and handouts (though I would point out getting a copy of your book was one hellofa handout). As for me and others I spoke with, we were very happy with you asking _us_ what _we_ wanted to get out of the class and then addressing our concerns. As I said earlier, my boss is fired up and another colleague -- a PHP fan -- was struck with how simple the Python code was. Now he's wanting to write some system monitoring software in Python. Well done!! I wish you well and hope to run into you again at some point. If there is anything I, or anyone in PyAR^2, can do for you, please ask. Best Regards, Always - --greg -------------- next part -------------- An HTML attachment was scrubbed... URL: From gslindstrom at gmail.com Tue Oct 14 16:10:02 2008 From: gslindstrom at gmail.com (Greg Lindstrom) Date: Tue, 14 Oct 2008 09:10:02 -0500 Subject: [PyAR2] Thanks for attending pyArkansas Message-ID: Hello, We are wrapping up the reporting for the pyArkansas conference held on October 4th and by all accounts we had a very good day. I wanted to thank you for attending and encourage you to keep learning! If you haven't done so already, you might want to consider joining the pyar2 mailing list. That way we can keep in touch (this is the only email you will receive unless you sign up). We're planning next years conference and things are looking good. More speakers and more classes. Drop us a note and let us know what you would like to see. Thanks again, Greg Lindstrom -------------- next part -------------- An HTML attachment was scrubbed... URL: From gslindstrom at gmail.com Tue Oct 14 20:41:32 2008 From: gslindstrom at gmail.com (Greg Lindstrom) Date: Tue, 14 Oct 2008 13:41:32 -0500 Subject: [PyAR2] OReilly Survey Message-ID: O'Reilly Media is conducting research about in-person, live workshops on software and business topics, and we'd really like your opinion. If you live in the United States and work in the tech industry, please consider taking our 19 question survey to help us understand what you look for in a live training course ? what motivates you, what you expect to get out of a workshop, what topics you'd like to see, and so forth. To participate, please go to: https://www.surveymonkey.com/s.aspx?sm=3bFGXzVnXige7WrPdJ0wAQ_3d_3d To show our appreciation, we'll select 10 people at random to receive a free book of your choice. The drawing will happen on Friday, October 17, so you'll need to complete the survey by that date to enter. The last question on the survey will ask for your e-mail ? we'll use that only to contact the randomly selected winners ? and your responses will remain anonymous. Thank you! Marsee Henon ================================================================ O'Reilly 1005 Gravenstein Highway North Sebastopol, CA 95472 http://ug.oreilly.com/ Follow us on Twitter at http://twitter.com/OReillyMedia -------------- next part -------------- An HTML attachment was scrubbed... URL: From gslindstrom at gmail.com Thu Oct 16 00:53:19 2008 From: gslindstrom at gmail.com (Greg Lindstrom) Date: Wed, 15 Oct 2008 17:53:19 -0500 Subject: [PyAR2] Mini Programming Challenge Message-ID: I'm not sure how many of you are new Python programmers, or *Pythonistas, *but here's a simple problem for you to work on. Post you code to the list and we can see how everyone does it. Here's the challenge (check out raw_input() for how to input a string): Write a program that prompts the user to enter a string of characters (it could be a word or a sentence or longer) and print out a report showing the number of times each letter appears in the word (or sentence). I'm just concerned about letters, but I don't care about case (both upper and lower case count the same). I'll post mine in a couple days. -greg -------------- next part -------------- An HTML attachment was scrubbed... URL: From phi3d at yahoo.com Thu Oct 16 09:05:31 2008 From: phi3d at yahoo.com (Gordon Fisher) Date: Thu, 16 Oct 2008 00:05:31 -0700 (PDT) Subject: [PyAR2] Mini Programming Challenge Message-ID: <749336.65114.qm@web65516.mail.ac4.yahoo.com> That was a good excuse to write my first python program from scratch.? I learned a lot. ? Here's what I came up with. ? # ParseText.py # Written on 10/16/2008 by Gordon Fisher # Reads in keystrokes from the keyboard into a string. # parses out how many times each letter appears in the string. # Prints out the results. keystrokes = [] letters = [0 for x in range (26)] keystrokes = raw_input() for x in range (len(keystrokes)): ??? askey = ord(keystrokes[x]) ??? if askey > 64 and askey < 91: # lower case letters ??????? letters[askey-65] = letters[askey-65]+1 ??? elif askey > 96 and askey < 123: # upper case letters ??????????? letters[askey-97] = letters[askey-97]+1 for x in range (26): ??? print 'There are '+ str(letters[x])+' ' + chr(x + 65)+'\''+ 's' ? Gordon Fisher http://www.pointhappy.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From pyar2 at cowsgomoo.org Thu Oct 16 13:28:55 2008 From: pyar2 at cowsgomoo.org (Coltrey Mather) Date: Thu, 16 Oct 2008 06:28:55 -0500 Subject: [PyAR2] Mini Programming Challenge In-Reply-To: References: Message-ID: #!/usr/bin/env python import sys import string from pprint import pprint words = {} chars = {} letters = {} for line in sys.stdin: for c in line: chars[c] = chars.setdefault(c, 0) + 1 if c in string.letters: letters[c.lower()] = letters.setdefault(c.lower(), 0) + 1 for word in line.split(): words[word.lower()] = words.setdefault(word.lower(), 0) + 1 for x in (("Word Counts", words,), ("Character Counts", chars,), ("Letter Counts", letters,),): print(x[0]) pprint(x[1]) print On Wed, Oct 15, 2008 at 17:53, Greg Lindstrom wrote: > I'm not sure how many of you are new Python programmers, or Pythonistas, > but here's a simple problem for you to work on. Post you code to the list > and we can see how everyone does it. Here's the challenge (check out > raw_input() for how to input a string): > > Write a program that prompts the user to enter a string of characters (it > could be a word or a sentence or longer) and print out a report showing the > number of times each letter appears in the word (or sentence). I'm just > concerned about letters, but I don't care about case (both upper and lower > case count the same). > > I'll post mine in a couple days. > > -greg > > _______________________________________________ > PyAR2 mailing list > PyAR2 at python.org > http://mail.python.org/mailman/listinfo/pyar2 > > From srilyk at gmail.com Thu Oct 16 19:14:20 2008 From: srilyk at gmail.com (W W) Date: Thu, 16 Oct 2008 12:14:20 -0500 Subject: [PyAR2] Mini Programming Challenge In-Reply-To: References: Message-ID: <333efb450810161014u2289d36et3419dff922cfc5c6@mail.gmail.com> I've actually done this before, though I'm not sure where my exercise went, but it was fairly simple so I'll see if I can write it in here :D mystr = raw_input("Please enter a string: ") mycount = {} for letter in mystr: try: mycount[letter] += 1 except KeyError: mycount[letter] = 1 print mycount That should be about as simple as you can get (though it will count whitespace and other characters). this should work for only alpha characters. If you want to ignore case, just add .lower() after .isalpha() mystr = raw_input("Please enter a string: ") mycount = {} for letter in mystr: if letter.isalpha(): try: mycount[letter] += 1 except KeyError: mycount[letter] = 1 print mycount -Wayne -------------- next part -------------- An HTML attachment was scrubbed... URL: From kwadroke at gmail.com Thu Oct 16 19:17:45 2008 From: kwadroke at gmail.com (Kwadroke of The Wired) Date: Thu, 16 Oct 2008 12:17:45 -0500 Subject: [PyAR2] PyArkansas 2008 article on the LogCabin Democrat website Message-ID: I just ran across this in my RSS feeds. http://www.thecabin.net/stories/101608/loc_1016080005.shtml -- Tony Bates - Kwadroke of The Wired Red Hat Certified Engineer Arkansas Geek Central: http://www.arkansasgeekcentral.com Geeks of Arkansas, Unite! From kwadroke at gmail.com Thu Oct 16 19:18:28 2008 From: kwadroke at gmail.com (Kwadroke of The Wired) Date: Thu, 16 Oct 2008 12:18:28 -0500 Subject: [PyAR2] PyArkansas 2008 article on the LogCabin Democrat website Message-ID: I just ran across this in my RSS feeds. http://www.thecabin.net/stories/101608/loc_1016080005.shtml -- Tony Bates - Kwadroke of The Wired Red Hat Certified Engineer Arkansas Geek Central: http://www.arkansasgeekcentral.com Geeks of Arkansas, Unite! From gslindstrom at gmail.com Thu Oct 16 20:25:45 2008 From: gslindstrom at gmail.com (Greg Lindstrom) Date: Thu, 16 Oct 2008 13:25:45 -0500 Subject: [PyAR2] PyArkansas 2008 article on the LogCabin Democrat website In-Reply-To: References: Message-ID: Hey...that Lindstrom guy says an awful lot :-) On Thu, Oct 16, 2008 at 12:18 PM, Kwadroke of The Wired wrote: > I just ran across this in my RSS feeds. > > http://www.thecabin.net/stories/101608/loc_1016080005.shtml > > -- > Tony Bates - Kwadroke of The Wired > Red Hat Certified Engineer > > Arkansas Geek Central: http://www.arkansasgeekcentral.com > Geeks of Arkansas, Unite! > _______________________________________________ > PyAR2 mailing list > PyAR2 at python.org > http://mail.python.org/mailman/listinfo/pyar2 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gslindstrom at gmail.com Thu Oct 16 21:16:18 2008 From: gslindstrom at gmail.com (Greg Lindstrom) Date: Thu, 16 Oct 2008 14:16:18 -0500 Subject: [PyAR2] PyAR2 Website Message-ID: OK...we've got something for the beginners to work on, now I'd like something for some of the rest of us to do. We need a web site. If nothing else, it will give us a web presence to link to. I'd also like to start thinking about what we may need for next year's conference. It would be great to have a single point to store class notes. links to software, test files, etc. It would also be nice to handle registration (especially if collect a fee) and allow people to order tee shirts, though if we needed to we could handle that at wearpython.com. Do any of you have web experience? I think we ought to build it in on of the Python frameworks, which has been known to end web sites for other groups (there's a lot of passion of which framework is "best"). I have a little Django experience, but if there's someone else with Django, TurboGears, Pylons, Zope or whatever who wants to lead an effort that would be OK, too. So, who do we have? What do you know? And what do we want in a web site? --greg -------------- next part -------------- An HTML attachment was scrubbed... URL: From Eric.Foster at modot.mo.gov Thu Oct 16 21:44:24 2008 From: Eric.Foster at modot.mo.gov (Eric.Foster at modot.mo.gov) Date: Thu, 16 Oct 2008 14:44:24 -0500 Subject: [PyAR2] Python Initiative for GIS and MidAmerica GIS Consortium Message-ID: I have been monitoring the recent conference via this listserv. Congratulations to all on a successful conference. I am also involved with GIS and the MidAmerica GIS Consortium (MAGIC). We hold the MAGIC Symposium every two years for GIS professionals across 8 states (Arkansas, Missouri, Kansas, Iowa, North Dakota, South Dakota, Nebraska, and Oklahoma). Since ArcGIS (ESRI GIS software) has strong roots in Python for its scripting and modeling language, we have attempted to provide workshops and training on Python language and scripting at our Symposiums. The last two Symposiums (2006 and 2008) had Python curriculums that were subpar at best. I am no programmer, but have been working with another GIS professional at developing a 4 hr course for GIS folks who are beginner programmers. We are looking for instructors for the next Symposium, and Python gurus to review our course materials for the 2010 Symposium (which will also be used in February 2009 at the Missouri GIS Conference). To my knowledge, there is no active Python group in Missouri or anywhere else in the midwest save your group and one in Iowa. If any of you Arkansas PyArtists are interested in instructing, the Symposium will be in 2010 in April in Kansas City. The Arkansas representatives on MAGIC include Learon Dalby GIS Program Manager, Arkansas Geographic Information Office), Susan Norton (CIO, Fayetteville Public Schools), Phyllis Pooche (GIS Applications Laboratory, University of Arkansas at Little Rock), Bill Sneed (USGS Geospatial Liaison for Arkansas). Their contact info is on the MAGIC website linked above. We would greatly appreciate some input from the programming Python community. If you can help in any way, please contact me. Eric Foster, Senior Transportation Planner MoDOT, 600 NE Colbern Rd. Lee's Summit, MO 64086 (816) 622-6330 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jhjaggars at gmail.com Thu Oct 16 23:22:37 2008 From: jhjaggars at gmail.com (Jesse Jaggars) Date: Thu, 16 Oct 2008 16:22:37 -0500 Subject: [PyAR2] Mini Programming Challenge In-Reply-To: References: Message-ID: <52a3495e0810161422m4160a43fn65a3082fba68c27c@mail.gmail.com> I probably went a little overboard with the comprehensions, but they are just so groovy. def count_letters(s): l_dict = {} for c in [ch.lower() for ch in filter(lambda x: x.isalpha(), s)]: l_dict.setdefault(c, []).append(c) return dict((ch, len(count)) for ch, count in l_dict.iteritems()) if __name__ == "__main__": import pprint pprint.pprint( count_letters(raw_input("Enter a string of characters: "))) From gslindstrom at gmail.com Fri Oct 17 00:00:06 2008 From: gslindstrom at gmail.com (gslindstrom at gmail.com) Date: Thu, 16 Oct 2008 15:00:06 -0700 Subject: [PyAR2] Mini Programming Challenge Message-ID: <0016364ee1e4c03092045965f897@google.com> On Oct 16, 2008 4:22pm, Jesse Jaggars wrote: > I probably went a little overboard with the comprehensions, Ya think?!? :-) And you use filter() AND lambda(), too??? Talk about cutting the butter with a chainsaw!! >but they are just so groovy. They really are. Why don't you write up a short little ditty explaining to everyone how list comprehensions work? Not a master class, just a few examples. They really can be a time saver. --greg -------------- next part -------------- An HTML attachment was scrubbed... URL: From jhjaggars at gmail.com Fri Oct 17 05:22:38 2008 From: jhjaggars at gmail.com (Jesse Jaggars) Date: Thu, 16 Oct 2008 22:22:38 -0500 Subject: [PyAR2] Mini Programming Challenge In-Reply-To: <0016364ee1e4c03092045965f897@google.com> References: <0016364ee1e4c03092045965f897@google.com> Message-ID: <52a3495e0810162022wd0c97f0o8219c7e81ca92cbc@mail.gmail.com> I made a short little document (reStructuredText) and attached it. I hope it's helpful. -------------- next part -------------- A non-text attachment was scrubbed... Name: python_comprehensions.rst Type: application/octet-stream Size: 2428 bytes Desc: not available URL: From supercooper at gmail.com Mon Oct 20 02:30:40 2008 From: supercooper at gmail.com (Chad Cooper) Date: Sun, 19 Oct 2008 19:30:40 -0500 Subject: [PyAR2] python code analyzer? Message-ID: <8398c3a60810191730w34719052n4e43099786b13023@mail.gmail.com> anyone know of a module/method that can tell me stats like: # lines of code # of comments/# of lines of comments # lines of whitespace etc this could be done easy enough with some re's, but if there is already something out there i sure dont want to reinvent the wheel thanks chad! -------------- next part -------------- An HTML attachment was scrubbed... URL: From srilyk at gmail.com Mon Oct 20 13:10:07 2008 From: srilyk at gmail.com (W W) Date: Mon, 20 Oct 2008 06:10:07 -0500 Subject: [PyAR2] python code analyzer? In-Reply-To: <8398c3a60810191730w34719052n4e43099786b13023@mail.gmail.com> References: <8398c3a60810191730w34719052n4e43099786b13023@mail.gmail.com> Message-ID: <333efb450810200410o3716426bhafc9c7e6674bdda@mail.gmail.com> Nothing that I know of, you might try the python tutor list. -Wayne On Sun, Oct 19, 2008 at 7:30 PM, Chad Cooper wrote: > anyone know of a module/method that can tell me stats like: > > # lines of code > # of comments/# of lines of comments > # lines of whitespace > etc > > this could be done easy enough with some re's, but if there is already > something out there i sure dont want to reinvent the wheel > > thanks > > > chad! > > _______________________________________________ > PyAR2 mailing list > PyAR2 at python.org > http://mail.python.org/mailman/listinfo/pyar2 > > -- To be considered stupid and to be told so is more painful than being called gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness, every vice, has found its defenders, its rhetoric, its ennoblement and exaltation, but stupidity hasn't. - Primo Levi -------------- next part -------------- An HTML attachment was scrubbed... URL: From pythonlarry at gmail.com Tue Oct 21 05:04:38 2008 From: pythonlarry at gmail.com (Larry Hale) Date: Mon, 20 Oct 2008 22:04:38 -0500 Subject: [PyAR2] Fwd: Mini Programming Challenge In-Reply-To: <2b9469390810152122w7a7eb50fi68d46beacf764eed@mail.gmail.com> References: <2b9469390810152122w7a7eb50fi68d46beacf764eed@mail.gmail.com> Message-ID: <2b9469390810202004p61dba182v7b8e2fa4a3477b8@mail.gmail.com> Sorry, Greg; looks like "with lack of sleep comes replying to the wrong entity..." :> ---------- Forwarded message ---------- From: Larry Hale Date: Wed, Oct 15, 2008 at 11:22 PM Subject: Re: [PyAR2] Mini Programming Challenge To: Greg Lindstrom # I'm not new, but thought I'd give my initial attempt - with lack of sleep comes verbosity?? :) # (Besides, it's always fun to see the more-elegant-than-mine/simply-different solutions to "simple" problems... :) from string import lowercase as lowercase_letters user_input = raw_input( 'Lay a string on me: ' ).lower() list_of_chars = list( user_input ) dict_of_chars = {} for c in list_of_chars: if c in lowercase_letters: if dict_of_chars.has_key( c ): dict_of_chars[ c ] += 1 else: dict_of_chars[ c ] = 1 print print print 'Letters used:' print list_of_chars = dict_of_chars.keys() for c in list_of_chars: print '\t"%s" used %s time%s' % ( c, dict_of_chars[ c ], { True: 's', False: '' }[ dict_of_chars[ c ] != 1 ] ) print print raw_input( 'Captain Irony Says: "Press [ENTER] to exit..."' ) # more simply... from string import lowercase as lowercase_letters user_input = raw_input( 'Lay a string on me: ' ).lower() print print print 'Letters used:' print for c in lowercase_letters: count = user_input.count( c ) if count: print '\t"%s" used %s time%s' % ( c, count, { True: 's', False: '' }[ count != 1 ] ) print print raw_input( 'Captain Irony Says: "Press [ENTER] to exit..."' ) # --------------------- On Wed, Oct 15, 2008 at 5:53 PM, Greg Lindstrom wrote: > I'm not sure how many of you are new Python programmers, or *Pythonistas, > *but here's a simple problem for you to work on. Post you code to the > list and we can see how everyone does it. Here's the challenge (check out > raw_input() for how to input a string): > > Write a program that prompts the user to enter a string of characters (it > could be a word or a sentence or longer) and print out a report showing the > number of times each letter appears in the word (or sentence). I'm just > concerned about letters, but I don't care about case (both upper and lower > case count the same). > > I'll post mine in a couple days. > > -greg > > _______________________________________________ > PyAR2 mailing list > PyAR2 at python.org > http://mail.python.org/mailman/listinfo/pyar2 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From supercooper at gmail.com Sun Oct 26 00:34:08 2008 From: supercooper at gmail.com (Chad Cooper) Date: Sat, 25 Oct 2008 17:34:08 -0500 Subject: [PyAR2] python code analyzer? In-Reply-To: <48FF90D9.8000308@unc.edu> References: <8398c3a60810191730w34719052n4e43099786b13023@mail.gmail.com> <48FF90D9.8000308@unc.edu> Message-ID: <8398c3a60810251534g140e334dy639b0a7aaa41de77@mail.gmail.com> Chris, those looks good, your Google skills are obviously better than mine. I'll check those out and report back. chad! On Wed, Oct 22, 2008 at 3:45 PM, Chris Calloway wrote: > On 10/19/2008 8:30 PM, Chad Cooper wrote: > >> anyone know of a module/method that can tell me stats like: >> >> # lines of code >> # of comments/# of lines of comments >> # lines of whitespace >> etc >> > > http://code.activestate.com/recipes/527746/ > http://python-forum.org/pythonforum/viewtopic.php?f=2&t=8709 > http://www.aminus.org/blogs/index.php/2007/07/09/lines_of_code?blog=2 > > -- > Sincerely, > > Chris Calloway > http://www.secoora.org > office: 332 Chapman Hall phone: (919) 599-3530 > mail: Campus Box #3300, UNC-CH, Chapel Hill, NC 27599 > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From supercooper at gmail.com Sun Oct 26 00:44:58 2008 From: supercooper at gmail.com (Chad Cooper) Date: Sat, 25 Oct 2008 17:44:58 -0500 Subject: [PyAR2] PyAR2 Website In-Reply-To: References: Message-ID: <8398c3a60810251544q149395aeq2abe63c19b72982f@mail.gmail.com> Well, we already have a domain name, I bought pyar2.org a few months back. I say we host it on WebFaction. Framework? Beats me. I have zero experience in Python web programming - but would love to learn. chad! On Thu, Oct 16, 2008 at 2:16 PM, Greg Lindstrom wrote: > OK...we've got something for the beginners to work on, now I'd like > something for some of the rest of us to do. We need a web site. If nothing > else, it will give us a web presence to link to. I'd also like to start > thinking about what we may need for next year's conference. It would be > great to have a single point to store class notes. links to software, test > files, etc. It would also be nice to handle registration (especially if > collect a fee) and allow people to order tee shirts, though if we needed to > we could handle that at wearpython.com. > > Do any of you have web experience? I think we ought to build it in on of > the Python frameworks, which has been known to end web sites for other > groups (there's a lot of passion of which framework is "best"). I have a > little Django experience, but if there's someone else with Django, > TurboGears, Pylons, Zope or whatever who wants to lead an effort that would > be OK, too. > > So, who do we have? What do you know? And what do we want in a web site? > > --greg > > _______________________________________________ > PyAR2 mailing list > PyAR2 at python.org > http://mail.python.org/mailman/listinfo/pyar2 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From supercooper at gmail.com Sun Oct 26 00:48:39 2008 From: supercooper at gmail.com (Chad Cooper) Date: Sat, 25 Oct 2008 17:48:39 -0500 Subject: [PyAR2] PyArkansas 2008 article on the LogCabin Democrat website In-Reply-To: References: Message-ID: <8398c3a60810251548qec09284j1c533b4266b106c7@mail.gmail.com> He sure does :-) Very, very cool that pyArkansas got press. Great job, everyone. chad! On Thu, Oct 16, 2008 at 1:25 PM, Greg Lindstrom wrote: > Hey...that Lindstrom guy says an awful lot :-) > > > > On Thu, Oct 16, 2008 at 12:18 PM, Kwadroke of The Wired < > kwadroke at gmail.com> wrote: > >> I just ran across this in my RSS feeds. >> >> http://www.thecabin.net/stories/101608/loc_1016080005.shtml >> >> -- >> Tony Bates - Kwadroke of The Wired >> Red Hat Certified Engineer >> >> Arkansas Geek Central: http://www.arkansasgeekcentral.com >> Geeks of Arkansas, Unite! >> _______________________________________________ >> PyAR2 mailing list >> PyAR2 at python.org >> http://mail.python.org/mailman/listinfo/pyar2 >> > > > _______________________________________________ > PyAR2 mailing list > PyAR2 at python.org > http://mail.python.org/mailman/listinfo/pyar2 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pythonlarry at gmail.com Sun Oct 26 21:02:04 2008 From: pythonlarry at gmail.com (Larry Hale) Date: Sun, 26 Oct 2008 15:02:04 -0500 Subject: [PyAR2] PyAR2 Website In-Reply-To: References: Message-ID: <2b9469390810261302u31939a99t43ca038c927ad86b@mail.gmail.com> WEBSITE: Ironically, in April I'd done some searching for web hosting that had mod_python standard. Webfaction was the only/best one I found. Anywho... I would humbly suggest we - and by "we", I of course mean those who have access/experience - setup a wiki environment for the main site to start off. This allows simple direct access for a community to add, change, update information. Perhaps edit-privileges would be limited to those who have signed up for PyAR^2 (and had their email confirmed)? I don't have any direct experience with any frameworks, nor wiki systems, but I've done a fair share of PHP dabbling for website programming, and have started working with mod-python for the same things. I have about 8 years of experience in both languages and would be happy to lend a hand+brain! http://en.wikipedia.org/wiki/List_of_wiki_software#Python-based <-- To peruse available wiki platforms. MoinMoin is used by python.org, so might not be a bad one to look at first? A Personal Home Page for each member might be nice; picture, do a short write-up, so that people can get to know each other. Discussion forums. Blogging software. Some sort of hybrid, really. (Folks can have their own personal blogs elsewhere; I'm thinking/discussing about PyAR^2-specific toplical pages. :) A wiki page on top, with user-/reader- posts on the bottom. Suggestion(s) for this? --- Way-cool would be where each user could have a virtual server - or at least mod_python environment - for putting projects (related to the User Group/discussions) online. (Versus having to have a personal web server or some such.) Although, with high-speed/always-on Inet being fairly common (everybody's got that, right?? ;), can simply host a server at home on an unused port and publish that link on the Group site. Eh, maybe not so useful?? :> --- LOGO: In April I'd also worked up some logo art; nothing original, but I still hope "witty". One of the first activities to do "with" the site, its sort of innaguration, could be do host the contest for picking our logo? Guess that means a voting system... http://moinmoin.wikiwikiweb.de/RatingSystemForMoin ?? --- CHALLENGES: I'd also started culling programming challenges on the 'Net to get some ideas for programming challenges we could have. (Thanks for the first one, Greg! :) I've got COPIOUS notes! (Would best be left for discussion until after Our Site is up. :) --- PROGRAMMING CONTESTS: For both a "challenge", as well as to get some different perspectives on the same problems. ("What" is easy; I've researched many of these things, too! :) What would you others think about something like the following? 1. The Gauntlet is thrown down! (Challenge description, rules, deadlines, etc.) 2. Entries are posted to the web site. (If people are worried about their code being seen before others, would there be a way to make pages "private" to them until a certain time? [Yeah, a py script could automatically change setting{s} to force such a thing, I'm sure, but any CMS/Wiki software do such a thing "out of the box"??]) 3. CHANGES LOCKED OUT, VOTING BEGINS! Categories could include: a. Swan (Ugly Duckling :) / Most Elegant Code Awards b. Most Efficient - runtime-wise (not open to "voting", I suppose :) c. Most Compact/Verbose d. The Perl Award (most obscure/obtuse :) e. Most-/Least-Pythonic Awards (some C/Java/YourNameHere programmers just can't seem to change ;) I've thought about something like this for programming shootouts *regardless* of language, too. But that's another story. Just some of my two cents! Cheers, Larry ===== On Thu, Oct 16, 2008 at 2:16 PM, Greg Lindstrom wrote: > OK...we've got something for the beginners to work on, now I'd like > something for some of the rest of us to do. We need a web site. If nothing > else, it will give us a web presence to link to. I'd also like to start > thinking about what we may need for next year's conference. It would be > great to have a single point to store class notes. links to software, test > files, etc. It would also be nice to handle registration (especially if > collect a fee) and allow people to order tee shirts, though if we needed to > we could handle that at wearpython.com. > > Do any of you have web experience? I think we ought to build it in on of > the Python frameworks, which has been known to end web sites for other > groups (there's a lot of passion of which framework is "best"). I have a > little Django experience, but if there's someone else with Django, > TurboGears, Pylons, Zope or whatever who wants to lead an effort that would > be OK, too. > > So, who do we have? What do you know? And what do we want in a web site? > > --greg > > _______________________________________________ > PyAR2 mailing list > PyAR2 at python.org > http://mail.python.org/mailman/listinfo/pyar2 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gslindstrom at gmail.com Mon Oct 27 23:33:26 2008 From: gslindstrom at gmail.com (gslindstrom at gmail.com) Date: Mon, 27 Oct 2008 15:33:26 -0700 Subject: [PyAR2] Programming Challenge II - One is the Magic Number Message-ID: <000e0cd6b0062db60b045a43b87b@google.com> This one's a little more advanced, but not too much. It comes from my friends at Car Talk and is this weeks "puzzler". I solved it first using basic math skills and some logic, but then wrote a program to confirm what I already knew; algebra will never let you down!! Here it is. Give it a shot. One is the Magic Number RAY: This was sent in by Martin Cohen and he says, ?No offense guys but your puzzlers of late have been less than stellar. Not to worry. Help is on the way.? Odometers on modern cars go from 0 to 999,999. There are no tenths; all the tenths are done by the trip odometer. Imagine that someone managed to reach 999,999 miles. If you counted all the times that the digit 1 appeared, how many 1s would be counted? In doing this, count each time that 1 appears in a number. So, for example, you would count 3 times for 1,101. Two times for 1,102. So how many times is the number 1 going to appear in going from 0 to 999,999? -------------- next part -------------- An HTML attachment was scrubbed... URL: From phi3d at yahoo.com Tue Oct 28 03:18:23 2008 From: phi3d at yahoo.com (Gordon Fisher) Date: Mon, 27 Oct 2008 19:18:23 -0700 (PDT) Subject: [PyAR2] Programming Challenge II - One is the Magic Number In-Reply-To: <000e0cd6b0062db60b045a43b87b@google.com> Message-ID: <578371.40571.qm@web65505.mail.ac4.yahoo.com> Here's my entry.? It's your basic brute force model.?I knew that others would find a more elegant way to do it, so I decided to make a generalized version that could count any digit from any number. ? #Gordon Fisher Oct 27, 2008 print "This program counts the number of times a single digit appears in a series of numbers from 0 to a selected number." Xstring = raw_input("Please enter a Number then press Enter, do not include commas: ") keynumstring = raw_input("Please enter a number from 0-9 that you wish to count then press Enter,: ") magicnum = int(Xstring) total = 0 xlen = 0 for x in range(magicnum +1): ??? Xstring = str(x) ??? xlen = len(Xstring) ??? stringtotal = Xstring.count(keynumstring,0,xlen) ??? total = total + stringtotal print "The number " + str(keynumstring) + " appears " + str(total) + " times." ? ? Gordon -------------- next part -------------- An HTML attachment was scrubbed... URL: From jhjaggars at gmail.com Tue Oct 28 06:09:45 2008 From: jhjaggars at gmail.com (Jesse Jaggars) Date: Tue, 28 Oct 2008 00:09:45 -0500 Subject: [PyAR2] Programming Challenge II - One is the Magic Number In-Reply-To: <578371.40571.qm@web65505.mail.ac4.yahoo.com> References: <000e0cd6b0062db60b045a43b87b@google.com> <578371.40571.qm@web65505.mail.ac4.yahoo.com> Message-ID: <52a3495e0810272209p2815ea52m4dd1a16f290d24be@mail.gmail.com> sum(int(str(x).count("1")) for x in xrange(1000000)) Or, if you prefer to supply the parameters: def howmany( needle, haystack ): return sum(int(str(z).count(str(needle))) for z in xrange(int(haystack))) From srilyk at gmail.com Tue Oct 28 12:33:44 2008 From: srilyk at gmail.com (W W) Date: Tue, 28 Oct 2008 05:33:44 -0600 Subject: [PyAR2] Programming Challenge II - One is the Magic Number In-Reply-To: <52a3495e0810272209p2815ea52m4dd1a16f290d24be@mail.gmail.com> References: <000e0cd6b0062db60b045a43b87b@google.com> <578371.40571.qm@web65505.mail.ac4.yahoo.com> <52a3495e0810272209p2815ea52m4dd1a16f290d24be@mail.gmail.com> Message-ID: <333efb450810280433h789c411cyad0b1ee9078d84b2@mail.gmail.com> That's a little more simplified than mine: In [7]: def foo(): ...: count = 0 ...: for x in xrange(0,1000000): ...: for num in str(x): ...: if num == '1': ...: count+=1 ...: return count ...: In [8]: foo() Out[8]: 600000 On Mon, Oct 27, 2008 at 11:09 PM, Jesse Jaggars wrote: > sum(int(str(x).count("1")) for x in xrange(1000000)) > > Or, if you prefer to supply the parameters: > > def howmany( needle, haystack ): > return sum(int(str(z).count(str(needle))) for z in > xrange(int(haystack))) > _______________________________________________ > PyAR2 mailing list > PyAR2 at python.org > http://mail.python.org/mailman/listinfo/pyar2 > -- To be considered stupid and to be told so is more painful than being called gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness, every vice, has found its defenders, its rhetoric, its ennoblement and exaltation, but stupidity hasn't. - Primo Levi -------------- next part -------------- An HTML attachment was scrubbed... URL: From gslindstrom at gmail.com Tue Oct 28 12:42:48 2008 From: gslindstrom at gmail.com (gslindstrom at gmail.com) Date: Tue, 28 Oct 2008 04:42:48 -0700 Subject: [PyAR2] Programming Challenge II - One is the Magic Number Message-ID: <000325574cea329125045a4ebfea@google.com> It's much better to use xrange() -- as you did -- for things like this. If you use range(), Python will create a list and then traverse through it. In our case, it will make an array with 1,000,000 elements. xrange() creates generator which creates the values as they are used. Your program is almost identical to mine, though I like Jesse's program in a Perlish sort of way (hey, Jesse...no offense intended!!). If I get the chance, I'll run them both and evaluate the time/cpu usage. --greg On Oct 28, 2008 6:33am, WW wrote: > That's a little more simplified than mine: -------------- next part -------------- An HTML attachment was scrubbed... URL: From srilyk at gmail.com Tue Oct 28 13:53:57 2008 From: srilyk at gmail.com (W W) Date: Tue, 28 Oct 2008 07:53:57 -0500 Subject: [PyAR2] Programming Challenge II - One is the Magic Number In-Reply-To: <000325574cea329125045a4ebfea@google.com> References: <000325574cea329125045a4ebfea@google.com> Message-ID: <333efb450810280553r14ef9220t3dd96db53f38bfe6@mail.gmail.com> On Tue, Oct 28, 2008 at 6:42 AM, wrote: > It's much better to use xrange() -- as you did -- for things like this. If > you use range(), Python will create a list and then traverse through it. In > our case, it will make an array with 1,000,000 elements. xrange() creates > generator which creates the values as they are used. Heh... yeah, I know :D Plenty of discussion on the tutor list about that. I'm not sure how long it takes one vs. the other, but I'm sure it's orders of magnitude! But it's good to point out the difference for those who aren't familiar. -Wayne -------------- next part -------------- An HTML attachment was scrubbed... URL: From srilyk at gmail.com Tue Oct 28 14:05:30 2008 From: srilyk at gmail.com (W W) Date: Tue, 28 Oct 2008 08:05:30 -0500 Subject: [PyAR2] Programming Challenge II - One is the Magic Number In-Reply-To: <333efb450810280553r14ef9220t3dd96db53f38bfe6@mail.gmail.com> References: <000325574cea329125045a4ebfea@google.com> <333efb450810280553r14ef9220t3dd96db53f38bfe6@mail.gmail.com> Message-ID: <333efb450810280605j6a179bdes8eb35743f0ec6872@mail.gmail.com> On Tue, Oct 28, 2008 at 7:53 AM, W W wrote: > I'm not sure how long it takes one vs. the other, but I'm sure it's > orders of magnitude! > I think I'm using timeit right...: In [9]: x = timeit.Timer('for i in range(1,1000000): pass') In [10]: t = timeit.Timer('for i in xrange(1,1000000): pass') In [11]: x.timeit(10) Out[11]: 1.8295149803161621 In [12]: t.timeit(10) Out[12]: 0.95827603340148926 In [13]: t.timeit(20) Out[13]: 2.1089239120483398 In [14]: x.timeit(20) Out[14]: 2.7574639320373535 In [15]: x.timeit(100) Out[15]: 12.90097188949585 In [16]: t.timeit(100) Out[16]: 8.7963299751281738 So that yeilds some interesting results (if I'm using the thing correctly): on 10 passes, it's about double the time. 20 passes it's a little less than 1.5x more, and 100 passes it's nearly 1.5 times more. I'm sure if someone cared enough they could either install matplotlib or at least write out a list of tuples with the coords. Actually I think I'll do that now ;) -Wayne -- To be considered stupid and to be told so is more painful than being called gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness, every vice, has found its defenders, its rhetoric, its ennoblement and exaltation, but stupidity hasn't. - Primo Levi -------------- next part -------------- An HTML attachment was scrubbed... URL: From pyar2 at cowsgomoo.org Tue Oct 28 14:34:27 2008 From: pyar2 at cowsgomoo.org (Coltrey Mather) Date: Tue, 28 Oct 2008 08:34:27 -0500 Subject: [PyAR2] Programming Challenge II - One is the Magic Number In-Reply-To: <000325574cea329125045a4ebfea@google.com> References: <000325574cea329125045a4ebfea@google.com> Message-ID: def f(x): '''Since I do x+1, you can enter 999999 and it'll be inclusive''' return len([i for i in ''.join(map(str, range(x+1))) if i is '1']) seems to be pretty fast (judged by profile.run()), since everything is in memory the slowest part is string conversion -- someone please tell me how to not need that. On Tue, Oct 28, 2008 at 06:42, wrote: > It's much better to use xrange() -- as you did -- for things like this. If > you use range(), Python will create a list and then traverse through it. In > our case, it will make an array with 1,000,000 elements. xrange() creates > generator which creates the values as they are used. Your program is almost > identical to mine, though I like Jesse's program in a Perlish sort of way > (hey, Jesse...no offense intended!!). If I get the chance, I'll run them > both and evaluate the time/cpu usage. > > --greg > > On Oct 28, 2008 6:33am, W W wrote: >> That's a little more simplified than mine: > > > _______________________________________________ > PyAR2 mailing list > PyAR2 at python.org > http://mail.python.org/mailman/listinfo/pyar2 > > From srilyk at gmail.com Tue Oct 28 15:16:51 2008 From: srilyk at gmail.com (W W) Date: Tue, 28 Oct 2008 09:16:51 -0500 Subject: [PyAR2] Programming Challenge II - One is the Magic Number In-Reply-To: References: <000325574cea329125045a4ebfea@google.com> Message-ID: <333efb450810280716u262212b8of5703f61bf65084c@mail.gmail.com> On Tue, Oct 28, 2008 at 8:34 AM, Coltrey Mather wrote: > def f(x): > '''Since I do x+1, you can enter 999999 and it'll be inclusive''' > return len([i > for i in > ''.join(map(str, range(x+1))) > if i is '1']) > > seems to be pretty fast (judged by profile.run()), since everything is > in memory the slowest part is string conversion -- someone please tell > me how to not need that. I doubt there's a faster method than string conversion... although here's another method that's a *lot* longer to work out: for x in xrange(0, 1000000): if x/1000000 == 1: count += 1 x%1000000 else: x%1000000 ... if x/10 == 1: count += 1 x = x%10 else: x = x%10 if x/1 == 1: count += 1 that *should* give you the right result... but it sure is a pain, and i doubt it would be any quicker than a string conversion, though it is pure math. -Wayne -------------- next part -------------- An HTML attachment was scrubbed... URL: From Eric.Foster at modot.mo.gov Tue Oct 28 15:34:51 2008 From: Eric.Foster at modot.mo.gov (Eric.Foster at modot.mo.gov) Date: Tue, 28 Oct 2008 09:34:51 -0500 Subject: [PyAR2] CarTalk Plug for Python??? Message-ID: Maybe someone could compile these variations of code and send them to Click and Clack. Might be good to have just a little plug for Python and PyAr2 on national radio. Does anyone recall what the "requirement" was for sending an entry? Usually they have some way to send an entry that includes some part of a vehicle or the like (ie, "send your entry written on the trunk lid of a 1972 Corvette" If we could get the requirement for this puzzler, we probably could come up with a creative way to satisfy the "requirement" enough to get them to mention Python and/or PyAr2. I listened to the program, but not close enough to remember the required entry format. If anyone knows, post it and I will try to come up with something creative to send to the CarTalk guys. Eric Foster, Senior Transportation Planner MoDOT, 600 NE Colbern Rd. Lee's Summit, MO 64086 (816) 622-6330 -------------- next part -------------- An HTML attachment was scrubbed... URL: From gslindstrom at gmail.com Tue Oct 28 15:36:40 2008 From: gslindstrom at gmail.com (Greg Lindstrom) Date: Tue, 28 Oct 2008 09:36:40 -0500 Subject: [PyAR2] CarTalk Plug for Python??? In-Reply-To: References: Message-ID: Here's the link...I enter almost every week (though I like the idea of sending it in on an old bumper, too). http://cartalk.com/content/puzzler/ On Tue, Oct 28, 2008 at 9:34 AM, wrote: > > Maybe someone could compile these variations of code and send them to Click > and Clack. Might be good to have just a little plug for Python and PyAr2 > on national radio. Does anyone recall what the "requirement" was for > sending an entry? Usually they have some way to send an entry that > includes some part of a vehicle or the like (ie, "send your entry written > on the trunk lid of a 1972 Corvette" If we could get the requirement for > this puzzler, we probably could come up with a creative way to satisfy the > "requirement" enough to get them to mention Python and/or PyAr2. I > listened to the program, but not close enough to remember the required entry > format. If anyone knows, post it and I will try to come up with something > creative to send to the CarTalk guys. > > Eric Foster, Senior Transportation Planner > MoDOT, 600 NE Colbern Rd. Lee's Summit, MO 64086 > (816) 622-6330 > > > _______________________________________________ > PyAR2 mailing list > PyAR2 at python.org > http://mail.python.org/mailman/listinfo/pyar2 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cbc at unc.edu Tue Oct 28 15:37:22 2008 From: cbc at unc.edu (Chris Calloway) Date: Tue, 28 Oct 2008 10:37:22 -0400 Subject: [PyAR2] Programming Challenge II - One is the Magic Number In-Reply-To: <52a3495e0810272209p2815ea52m4dd1a16f290d24be@mail.gmail.com> References: <000e0cd6b0062db60b045a43b87b@google.com> <578371.40571.qm@web65505.mail.ac4.yahoo.com> <52a3495e0810272209p2815ea52m4dd1a16f290d24be@mail.gmail.com> Message-ID: <490723A2.2010702@unc.edu> On 10/28/2008 1:09 AM, Jesse Jaggars wrote: > sum(int(str(x).count("1")) for x in xrange(1000000)) You don't need the int(). count() returns an int. -- Sincerely, Chris Calloway http://www.secoora.org office: 332 Chapman Hall phone: (919) 599-3530 mail: Campus Box #3300, UNC-CH, Chapel Hill, NC 27599 From gslindstrom at gmail.com Tue Oct 28 15:46:54 2008 From: gslindstrom at gmail.com (Greg Lindstrom) Date: Tue, 28 Oct 2008 09:46:54 -0500 Subject: [PyAR2] Programming Challenge II - One is the Magic Number In-Reply-To: <52a3495e0810280742p58419ae2u30cbbc1189d8165f@mail.gmail.com> References: <000325574cea329125045a4ebfea@google.com> <52a3495e0810280742p58419ae2u30cbbc1189d8165f@mail.gmail.com> Message-ID: On Tue, Oct 28, 2008 at 9:42 AM, Jesse Jaggars wrote: > > generator which creates the values as they are used. Your program is > almost > > identical to mine, though I like Jesse's program in a Perlish sort of way > > (hey, Jesse...no offense intended!!). > > None taken; It's a fair assessment. Problems of this nature lend > themselves well to code that probably shouldn't see the light of day. > :) One thing the Perl community does that I really enjoy is they "play golf"; that is, they try to solve a programming challenge in the fewest characters possible. It leads to some really bazaar code but is a great way to learn the intricacies of the language. Python does not lend itself to "golf" as well as Perl. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jhjaggars at gmail.com Tue Oct 28 15:42:55 2008 From: jhjaggars at gmail.com (Jesse Jaggars) Date: Tue, 28 Oct 2008 09:42:55 -0500 Subject: [PyAR2] Programming Challenge II - One is the Magic Number In-Reply-To: <000325574cea329125045a4ebfea@google.com> References: <000325574cea329125045a4ebfea@google.com> Message-ID: <52a3495e0810280742p58419ae2u30cbbc1189d8165f@mail.gmail.com> > generator which creates the values as they are used. Your program is almost > identical to mine, though I like Jesse's program in a Perlish sort of way > (hey, Jesse...no offense intended!!). None taken; It's a fair assessment. Problems of this nature lend themselves well to code that probably shouldn't see the light of day. :) From supercooper at gmail.com Thu Oct 30 19:08:36 2008 From: supercooper at gmail.com (supercooper at gmail.com) Date: Thu, 30 Oct 2008 11:08:36 -0700 Subject: [PyAR2] Fwd: ANN: The first official Python coin has just been released in the Netherlands. Message-ID: <00221532ced095019e045a7c5e72@google.com> Very, very cool. chad ---------- Forwarded message ---------- From: Stani Date: Oct 29, 2008 5:29pm Subject: ANN: The first official Python coin has just been released in the Netherlands. To: comp-lang-python-announce at moderators.isc.org > I am pleased to announce that I won the competition for the next 5 > > > euro commemorative coin with the theme 'Netherlands and Architecture'. > > > The design of the coin was totally developed with python. I used PIL > > > for raster image manipulation and pyCairo for generating vector > > > graphics. > > > > > > For more info see: > > > http://pythonide.blogspot.com/2008/10/how-to-make-money-with-free-software.html > > > -- > > > http://mail.python.org/mailman/listinfo/python-announce-list > > > > > > Support the Python Software Foundation: > > > http://www.python.org/psf/donations.html > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: