From mpfaiffer at callapple.org Wed Feb 1 18:33:01 2006 From: mpfaiffer at callapple.org (Mike Pfaiffer) Date: Wed, 01 Feb 2006 17:33:01 -0600 Subject: [Python Wpg] Yet another quick reference guide URL Message-ID: <200602011733.01020.mpfaiffer@callapple.org> It's a big one... Later Mike http://rgruet.free.fr/PQR24/PQR2.4.html -- +----------------------------------------------------------------------+ |Call-A.P.P.L.E. and the Digital Civilization http://www.callapple.org | | http://members.shaw.ca/pfaiffer = Mike Pfaiffer (B.A., B.Sc.) | +----------------------------------------------------------------------+ ----- BEGIN GEEK CODE BLOCK ----- Version: 3.12 GCS/G/IT/PA/SS d s+:- a? C++ UL L++ W++ N++ o+ K- w(---) O+@ M++@ V PS+ PE !PGP t+ 5+ X R tv b+ DI+++ D++ G e++* h! r-- !y-- UF++ ------ END GEEK CODE BLOCK ------ From stuartw at mts.net Mon Feb 13 11:55:10 2006 From: stuartw at mts.net (Stuart Williams) Date: Mon, 13 Feb 2006 10:55:10 -0600 Subject: [Python Wpg] Who wants to present next Wednesday? Message-ID: <17392.47598.997078.346856@localhost.localdomain> Our scheduled presenter for next Wednesday's (February 22nd) meeting has had to cancel. Would anyone (or two) like to fill in with a short presentation (or two)? Stuart. From umjenki5 at cc.umanitoba.ca Tue Feb 14 01:45:24 2006 From: umjenki5 at cc.umanitoba.ca (Mark Jenkins) Date: Tue, 14 Feb 2006 00:45:24 -0600 Subject: [Python Wpg] Who wants to present next Wednesday? In-Reply-To: <17392.47598.997078.346856@localhost.localdomain> References: <17392.47598.997078.346856@localhost.localdomain> Message-ID: <43F17C84.3050209@cc.umanitoba.ca> > Would anyone (or two) like to fill in with a short > presentation (or two)? I'll show off some code. Could also demo list comprehension too. Mark Apologies to Stuart for him seeing this reply twice. [I accidentally rreplied to him only] We should change the default list reply-to to be the list itself From broek at cc.umanitoba.ca Tue Feb 14 07:46:46 2006 From: broek at cc.umanitoba.ca (Brian van den Broek) Date: Tue, 14 Feb 2006 06:46:46 -0600 Subject: [Python Wpg] List reply to [WAS] Re: Who wants to present next Wednesday? In-Reply-To: <43F17C84.3050209@cc.umanitoba.ca> References: <17392.47598.997078.346856@localhost.localdomain> <43F17C84.3050209@cc.umanitoba.ca> Message-ID: <43F1D136.8050304@cc.umanitoba.ca> Mark Jenkins said unto the world upon 14/02/06 12:45 AM: > Apologies to Stuart for him seeing this reply twice. [I accidentally > rreplied to him only] We should change the default list reply-to to be > the list itself Hi all, I'd favour leaving it as is, on the grounds of principle of least damage. See . I do recognize this comes perilously close to a religious issue, though. Best to all, Brian vdB From umjenki5 at cc.umanitoba.ca Tue Feb 14 18:12:28 2006 From: umjenki5 at cc.umanitoba.ca (Mark Jenkins) Date: Tue, 14 Feb 2006 17:12:28 -0600 Subject: [Python Wpg] List reply to In-Reply-To: <43F1D136.8050304@cc.umanitoba.ca> References: <17392.47598.997078.346856@localhost.localdomain> <43F17C84.3050209@cc.umanitoba.ca> <43F1D136.8050304@cc.umanitoba.ca> Message-ID: <43F263DC.6050201@cc.umanitoba.ca> > See . I'm sold. All this time I've been using a mail client that made this easy for me, and didn't even realize it. Thunderbird has a Reply All action. I see that it does a To: to the person being directly replied to, and a cc to the list. I guess the list will see this and not send Brian this message twice, correct? I can make Thunderbird do the right thing if a To: winnipeg at python.org is the right thing. (because it's free software!) I have made the mistake of going public when private would of been preferred. Good to be explicit in this choice each time. Mark From broek at cc.umanitoba.ca Wed Feb 15 04:40:13 2006 From: broek at cc.umanitoba.ca (Brian van den Broek) Date: Wed, 15 Feb 2006 03:40:13 -0600 Subject: [Python Wpg] List reply to In-Reply-To: <43F263DC.6050201@cc.umanitoba.ca> References: <17392.47598.997078.346856@localhost.localdomain> <43F17C84.3050209@cc.umanitoba.ca> <43F1D136.8050304@cc.umanitoba.ca> <43F263DC.6050201@cc.umanitoba.ca> Message-ID: <43F2F6FD.5050907@cc.umanitoba.ca> Mark Jenkins said unto the world upon 14/02/06 05:12 PM: >>See . > > > I'm sold. No fair. I'd been looking forward to rounds of senseless bickering followed by an extended period of bitter acrimony. > I guess the list will see this and not send > Brian this message twice, correct? IIRC, that I got a single copy is a function of how I've set my python.org mailinglist preferences. I am on some other lists with list admin software less good than mailman and where there is no option to avoid dups. Best, Brian vdB From umjenki5 at cc.umanitoba.ca Tue Feb 21 06:36:19 2006 From: umjenki5 at cc.umanitoba.ca (Mark Jenkins) Date: Tue, 21 Feb 2006 05:36:19 -0600 Subject: [Python Wpg] Wednesday February 22, 7:30 meeting Message-ID: <43FAFB33.6020101@cc.umanitoba.ca> I'm the presenter Wednesday. I will open the meeting with an explanation and demonstration of a powerful feature called list comprehensions. http://docs.python.org/tut/node7.html#SECTION007140000000000000000 I will show how one could rewrite a list comprehension if the feature was unavailable, this will help illustrate the meaning of the syntax. After that, I will dive into my code archive and demonstrate code I have written in my first year as a python programmer. I will go through n out of 3 programs, the size of n depending on audience preference and time. The audience will determine the order. * An academic B plus tree implementation. (I did this as a course assignment) * Two sudoku solvers, one dramatically more efficient than the other * A program to determine when to hold a meeting based on individual time preferences. I submitted this to the list in the past when we were trying to determine a meeting time. Stewart, I never found out if you used this or not. From stuartw at mts.net Tue Feb 21 09:33:36 2006 From: stuartw at mts.net (Stuart Williams) Date: Tue, 21 Feb 2006 08:33:36 -0600 Subject: [Python Wpg] Wednesday February 22, 7:30 meeting In-Reply-To: <43FAFB33.6020101@cc.umanitoba.ca> References: <43FAFB33.6020101@cc.umanitoba.ca> Message-ID: <17403.9408.863284.555970@localhost.localdomain> >>>>> Mark Jenkins writes: > Subject: [Python Wpg] Wednesday February 22, 7:30 meeting > * A program to determine when to hold a meeting based on individual > time preferences. I submitted this to the list in the past when we > were trying to determine a meeting time. Stewart, I never found out > if you used this or not. I did! It was handy. I made a few changes for data entry. First I changed this: { 'day' : 'Tue', 'ofMonth' : (3,4), 'startTime' : '16:00', 'endTime' : '22:00' }, to this: dict(day = 'Tue', ofMonth = (3,4), startTime = '16:00', endTime = '22:00'), Next I changed it to this even more compact easier to type format: s = """ User Name Tue 34 16:00 22:00 Wed 34 16:00 22:00 """ which I parsed thusly: for line in s.split('\n')[1:-1]: # drop first and last empties if line.startswith(' '): day, ofMonth, startTime, endTime = line.split() ofMonth = tuple( [int(m) for m in tuple(ofMonth)] ) priorities_for_each_person.setdefault(name, []).append( dict(day = day, ofMonth = ofMonth, startTime = startTime, endTime = endTime)) else: name = line.strip() Stuart. From umjenki5 at cc.umanitoba.ca Tue Feb 21 09:39:06 2006 From: umjenki5 at cc.umanitoba.ca (Mark Jenkins) Date: Tue, 21 Feb 2006 08:39:06 -0600 Subject: [Python Wpg] Wednesday February 22, 7:30 meeting In-Reply-To: <17403.9408.863284.555970@localhost.localdomain> References: <43FAFB33.6020101@cc.umanitoba.ca> <17403.9408.863284.555970@localhost.localdomain> Message-ID: <43FB260A.9040005@cc.umanitoba.ca> Do you still have a copy of the full source after your changes? Could I get a copy for the meeting? From broek at cc.umanitoba.ca Wed Feb 22 19:52:55 2006 From: broek at cc.umanitoba.ca (Brian van den Broek) Date: Wed, 22 Feb 2006 18:52:55 -0600 Subject: [Python Wpg] Wednesday February 22, 7:30 meeting In-Reply-To: <43FAFB33.6020101@cc.umanitoba.ca> References: <43FAFB33.6020101@cc.umanitoba.ca> Message-ID: <43FD0767.40207@cc.umanitoba.ca> Mark Jenkins said unto the world upon 21/02/06 05:36 AM: > I'm the presenter Wednesday. > > I will open the meeting with an explanation and demonstration of a > powerful feature called list comprehensions. > http://docs.python.org/tut/node7.html#SECTION007140000000000000000 Hi all, I've come to the reluctant conclusion that I've got to stay home and work. So, my regrets and a good meeting to all. Brian vdB From mpfaiffer at callapple.org Fri Feb 24 16:42:15 2006 From: mpfaiffer at callapple.org (Mike Pfaiffer) Date: Fri, 24 Feb 2006 15:42:15 -0600 Subject: [Python Wpg] Newbie question Message-ID: <200602241542.15920.mpfaiffer@callapple.org> I'm redoing an old public domain Apple// BASIC (text) game in Python and submitting it as an article to the magazine in the .signature. I've been working on it for a couple of weeks an hour at a time (it's a simple game). It's a good way to learn the language. I've been following the tutorial and for the most part I can get by experimenting with the examples. I'll admit my technique leaves a lot to be desired (it's my first Python program - I'll clean it up when it's working). With expectations suitably lowered, here is my question... I have a large list (2D array of single character strings) I want duplicated. Assignment (a = b) copies the pointers and not the values. Rather than copy the list item by item (which isn't out of the question), is there a simple way I haven't seen yet to make a separate copy of the list? I'd like to change one list but not the other. FYI, I haven't quite got my head around the OO style of programming yet. Hopefully this year I'll try something which gives me the spark of insight I haven't got yet. Later Mike -- +----------------------------------------------------------------------+ |Call-A.P.P.L.E. and the Digital Civilization http://www.callapple.org | | http://members.shaw.ca/pfaiffer = Mike Pfaiffer (B.A., B.Sc.) | +----------------------------------------------------------------------+ ----- BEGIN GEEK CODE BLOCK ----- Version: 3.12 GCS/G/IT/PA/SS d s+:- a? C++ UL L++ W++ N++ o+ K- w(---) O+@ M++@ V PS+ PE !PGP t+ 5+ X R tv b+ DI+++ D++ G e++* h! r-- !y-- UF++ ------ END GEEK CODE BLOCK ------ From dave at gabrielson.ca Fri Feb 24 16:59:32 2006 From: dave at gabrielson.ca (Dave Gabrielson) Date: Fri, 24 Feb 2006 15:59:32 -0600 Subject: [Python Wpg] Newbie question In-Reply-To: <200602241542.15920.mpfaiffer@callapple.org> References: <200602241542.15920.mpfaiffer@callapple.org> Message-ID: <200602241559.32478.dave@gabrielson.ca> This one can take some digging if you don't know about it. I've been bit before, so I know about it: import copy a = copy.deepcopy(b) will make new versions of everything contained by b for a. --Dave. On February 24, 2006 03:42 pm, Mike Pfaiffer wrote: > I'm redoing an old public domain Apple// BASIC (text) game in Python and > submitting it as an article to the magazine in the .signature. I've been > working on it for a couple of weeks an hour at a time (it's a simple game). > It's a good way to learn the language. I've been following the tutorial and > for the most part I can get by experimenting with the examples. I'll admit > my technique leaves a lot to be desired (it's my first Python program - > I'll clean it up when it's working). With expectations suitably lowered, > here is my question... > > I have a large list (2D array of single character strings) I want > duplicated. Assignment (a = b) copies the pointers and not the values. > Rather than copy the list item by item (which isn't out of the question), > is there a simple way I haven't seen yet to make a separate copy of the > list? I'd like to change one list but not the other. > > FYI, I haven't quite got my head around the OO style of programming yet. > Hopefully this year I'll try something which gives me the spark of insight > I haven't got yet. > > Later > Mike From mpfaiffer at callapple.org Fri Feb 24 19:03:15 2006 From: mpfaiffer at callapple.org (Mike Pfaiffer) Date: Fri, 24 Feb 2006 18:03:15 -0600 Subject: [Python Wpg] Newbie question In-Reply-To: <200602241559.32478.dave@gabrielson.ca> References: <200602241542.15920.mpfaiffer@callapple.org> <200602241559.32478.dave@gabrielson.ca> Message-ID: <200602241803.16288.mpfaiffer@callapple.org> On February 24, 2006 03:59 pm, Dave Gabrielson wrote this amazing epistle: > This one can take some digging if you don't know about it. > I've been bit before, so I know about it: > > import copy > > a = copy.deepcopy(b) > > will make new versions of everything contained by b for a. > > --Dave. Thanks. I didn't see anything appropriate in the language reference or tutorial. I suspect it's one of those things I missed. I'll try it out in a couple of hours (supper is almost ready). It looks like one of those OOP things. Correct? Later Mike > On February 24, 2006 03:42 pm, Mike Pfaiffer wrote: > > I'm redoing an old public domain Apple// BASIC (text) game in Python and > > submitting it as an article to the magazine in the .signature. I've been > > working on it for a couple of weeks an hour at a time (it's a simple > > game). It's a good way to learn the language. I've been following the > > tutorial and for the most part I can get by experimenting with the > > examples. I'll admit my technique leaves a lot to be desired (it's my > > first Python program - I'll clean it up when it's working). With > > expectations suitably lowered, here is my question... > > > > I have a large list (2D array of single character strings) I want > > duplicated. Assignment (a = b) copies the pointers and not the values. > > Rather than copy the list item by item (which isn't out of the question), > > is there a simple way I haven't seen yet to make a separate copy of the > > list? I'd like to change one list but not the other. > > > > FYI, I haven't quite got my head around the OO style of programming yet. > > Hopefully this year I'll try something which gives me the spark of > > insight I haven't got yet. > > > > Later > > Mike -- +----------------------------------------------------------------------+ |Call-A.P.P.L.E. and the Digital Civilization http://www.callapple.org | | http://members.shaw.ca/pfaiffer = Mike Pfaiffer (B.A., B.Sc.) | +----------------------------------------------------------------------+ ----- BEGIN GEEK CODE BLOCK ----- Version: 3.12 GCS/G/IT/PA/SS d s+:- a? C++ UL L++ W++ N++ o+ K- w(---) O+@ M++@ V PS+ PE !PGP t+ 5+ X R tv b+ DI+++ D++ G e++* h! r-- !y-- UF++ ------ END GEEK CODE BLOCK ------ From billreid at shaw.ca Fri Feb 24 22:17:17 2006 From: billreid at shaw.ca (Bill Reid) Date: Fri, 24 Feb 2006 21:17:17 -0600 Subject: [Python Wpg] Newbie question In-Reply-To: <200602241803.16288.mpfaiffer@callapple.org> References: <200602241542.15920.mpfaiffer@callapple.org> <200602241559.32478.dave@gabrielson.ca> <200602241803.16288.mpfaiffer@callapple.org> Message-ID: <43FFCC3D.2020409@shaw.ca> Mike Pfaiffer wrote: > On February 24, 2006 03:59 pm, Dave Gabrielson wrote this amazing epistle: >> This one can take some digging if you don't know about it. >> I've been bit before, so I know about it: >> >> import copy >> >> a = copy.deepcopy(b) > > Thanks. I didn't see anything appropriate in the language reference or > tutorial. I suspect it's one of those things I missed. I'll try it out in a > couple of hours (supper is almost ready). > > It looks like one of those OOP things. Correct? > I would not call it an OO thing. It is just that many languages do not copy arrays by value since there is a big potential performance hit. What I have found working with Perl, Python, Ruby, PHP, Tcl, VBasic... it is not the language semantics and syntax that takes the longest to master. You of course have to get your head around the "way" of programming in a specific language. The real rub is the function libraries. For being productive the power is in the libraries. It is a pleasure if a new language has at least keep the same names for similar functions as older languages. For example Ruby sticks pretty close to Perl names. Since the names are somewhat arbitrary I find it difficult to keep track of which function goes with which language. Now is it index or instr, etc. That aside, Perl is a bit different since it embeds a lot of "functions" in syntax. -- Bill --