From rdm at cfcl.com Sun Apr 2 00:16:16 2006 From: rdm at cfcl.com (Rich Morin) Date: Sun, 2 Apr 2006 00:16:16 -0800 Subject: [sf-perl] Python indentation grumble Message-ID: pywikipediabot is (fairly obviously) a Python-based framework for writing bots to crawl Wikipedia (or really, MediaWiki) pages. In trying to configure this, I found myself writing tiny bits of Python, commenting out some lines, etc: vvvv family = 'ontiki' usernames['ontiki']['en'] = 'RichMorinBot' # usernames['None']['en'] = 'RichMorinBot' ^^^^ Because I don't like the way this looks, I tried indenting all of the code to a consistent base level, as: vvvv family = 'ontiki' usernames['ontiki']['en'] = 'RichMorinBot' # usernames['None']['en'] = 'RichMorinBot' ^^^^ However, this offends the interpreter quite drastically: vvvv ... family = 'ontiki' ^ SyntaxError: invalid syntax ^^^^ So, I get to decide whether to give up on my preferred style of indentation or hack around the interpreter. As you might expect, I chose the latter: vvvv if 1 == 1: # Kludge around indentation brain-damage. family = 'ontiki' usernames['ontiki']['en'] = 'RichMorinBot' # usernames['None' ]['en'] = 'RichMorinBot' ^^^^ !@#$% -r -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm at cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841 Technical editing and writing, programming, and web development From josh at agliodbs.com Sun Apr 2 14:57:00 2006 From: josh at agliodbs.com (Josh Berkus) Date: Sun, 2 Apr 2006 14:57:00 -0700 Subject: [sf-perl] Python indentation grumble In-Reply-To: References: Message-ID: <200604021457.00164.josh@agliodbs.com> Rich, > pywikipediabot is (fairly obviously) a Python-based framework > for writing bots to crawl Wikipedia (or really, MediaWiki) > pages. ?In trying to configure this, I found myself writing > tiny bits of Python, commenting out some lines, etc: This is how python *works*, Rich. One might as well bitch about weak variable typing in Perl. -- Josh Berkus Aglio Database Solutions San Francisco From rdm at cfcl.com Sun Apr 2 17:46:18 2006 From: rdm at cfcl.com (Rich Morin) Date: Sun, 2 Apr 2006 16:46:18 -0800 Subject: [sf-perl] Python indentation grumble In-Reply-To: <200604021457.00164.josh@agliodbs.com> References: <200604021457.00164.josh@agliodbs.com> Message-ID: At 2:57 PM -0700 4/2/06, Josh Berkus wrote: > This is how python *works*, Rich. One might as well bitch > about weak variable typing in Perl. I disagree. I accept the fact that Python: * uses indentation to indicate block structure * disallows indentation that is ambiguous However, note that Python allows certain types of indentation that do not indicate block structure: * Continued statements may be indented as desired, as long as they are to the right of the initial line. * Comments can be indented as desired. The guiding principle appears to be "Allow arbitrary indentation, as long as it doesn't get in the way of block structure." If this is true, disallowing an arbitrary first-level indent is simply a mistake, and one which (like allowing tabs as indentation) YAML does not make. But then, YAML had the chance to look at Python's mistakes, avoid them, and make its own (:-). -r P.S. GvR will be at the ACCU meeting this Wednesday: > When: Wednesday, April 5, 2006 > Topic: A Look At Python's Future > Speaker: Guido van Rossum > Time: 7:00pm > Where: eBay Town Hall (next to PayPal/eBay) > 2161 North First St > San Jose, CA 95131 > Map: > Cost: Free > More Info: > > Guido van Rossum is the creator of Python, one of the > major free scripting languages. He created Python in > the early 1990s at CWI in Amsterdam, and is still > actively involved in the development of the language. > > In 1995 he moved to the US; first to work for CNRI in > Reston, VA as a researcher, then for Zope Corporation > as Director of PythonLabs, then, after a move to the > SF bay area, for Elemental Security, and then, since > December 2005, Google. > > His home on the web is . -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm at cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841 Technical editing and writing, programming, and web development From chris at noncombatant.org Sun Apr 2 17:09:43 2006 From: chris at noncombatant.org (Chris Palmer) Date: Sun, 2 Apr 2006 17:09:43 -0700 Subject: [sf-perl] Python indentation grumble In-Reply-To: References: <200604021457.00164.josh@agliodbs.com> Message-ID: <20060403000943.GA1522@nodewarrior.org> Rich Morin writes: > At 2:57 PM -0700 4/2/06, Josh Berkus wrote: > > This is how python *works*, Rich. One might as well bitch about > > weak variable typing in Perl. > > If this is true, disallowing an arbitrary first-level indent is simply > a mistake, and one which (like allowing tabs as indentation) YAML does > not make. Complaining about the syntactic aspect of language design on a Perl list causes the irony sensor in my cerebellum to burn painfully. Please stop. Can we please follow Josh's lead and complain about semantics instead? Thanks. -- http://www.noncombatant.org/ http://www.boshuda.com/ From rdm at cfcl.com Sun Apr 2 18:59:25 2006 From: rdm at cfcl.com (Rich Morin) Date: Sun, 2 Apr 2006 17:59:25 -0800 Subject: [sf-perl] Python indentation grumble In-Reply-To: <20060403000943.GA1522@nodewarrior.org> References: <200604021457.00164.josh@agliodbs.com> <20060403000943.GA1522@nodewarrior.org> Message-ID: At 5:09 PM -0700 4/2/06, Chris Palmer wrote: > Complaining about the syntactic aspect of language design > on a Perl list causes the irony sensor in my cerebellum > to burn painfully. Please stop. Sorry, The Man With Too Many Initials (MDPKSL) decreed that we get to talk about about pretty much anything. So, deal. > Can we please follow Josh's lead and complain about semantics > instead? Thanks. Yes and no. You're quite welcome to discuss semantics in this thread or start a separate semantics thread. Just don't try to kick the original topic out of this thread! -r -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm at cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841 Technical editing and writing, programming, and web development From rick at linuxmafia.com Sun Apr 2 19:41:17 2006 From: rick at linuxmafia.com (Rick Moen) Date: Sun, 2 Apr 2006 19:41:17 -0700 Subject: [sf-perl] Python indentation grumble In-Reply-To: References: <200604021457.00164.josh@agliodbs.com> Message-ID: <20060403024117.GV5311@linuxmafia.com> Quoting Rich Morin (rdm at cfcl.com): > If this is true, disallowing an arbitrary first-level indent > is simply a mistake [snip] Rich, you make a fine Perl (and probably Ruby) person, but I think you're simply not destined to be a Pythonista -- which is fine: We like you just the way you are. ;-> From matt at cloudfactory.org Mon Apr 3 11:10:03 2006 From: matt at cloudfactory.org (Matthew Lanier) Date: Mon, 3 Apr 2006 11:10:03 -0700 (PDT) Subject: [sf-perl] Python indentation grumble In-Reply-To: Message-ID: On Sun, 2 Apr 2006, Rich Morin wrote: > At 5:09 PM -0700 4/2/06, Chris Palmer wrote: > > Complaining about the syntactic aspect of language design > > on a Perl list causes the irony sensor in my cerebellum > > to burn painfully. Please stop. > > Sorry, The Man With Too Many Initials (MDPKSL) decreed that > we get to talk about about pretty much anything. So, deal. > i tend to trust that rich's (and yours, likely) odd syntactical musings have a place at the sfpug, and serve as commentary on perl by comparison. now if rich were "all python bitching, all the time", i might take offense. but as TIMTOWTDI, i'm cool with the occasional cross language post, which doesn't happen that often around here anyway. love, Matthew David Peter Kyle Strelchun Lanier Chief Heckler, SFPUG From rick at linuxmafia.com Mon Apr 3 11:18:10 2006 From: rick at linuxmafia.com (Rick Moen) Date: Mon, 3 Apr 2006 11:18:10 -0700 Subject: [sf-perl] Python indentation grumble In-Reply-To: References: Message-ID: <20060403181810.GC3332@linuxmafia.com> Quoting Matthew Lanier (matt at cloudfactory.org): > i tend to trust that rich's (and yours, likely) odd syntactical musings > have a place at the sfpug. Oh, just to clarify: I wasn't disagreeing with that stance or in any way trying to discourage Rich. It was more like... just expressing mild amusement and fellow-feeling. From paul at makepeace.net Mon Apr 3 17:55:11 2006 From: paul at makepeace.net (Paul Makepeace) Date: Tue, 4 Apr 2006 01:55:11 +0100 Subject: [sf-perl] Python indentation grumble In-Reply-To: References: Message-ID: <20060404005511.GL13673@mythix.realprogrammers.com> Je 2006-04-02 09:16:16 +0100, Rich Morin skribis: > vvvv > family = 'ontiki' > usernames['ontiki']['en'] = 'RichMorinBot' > # usernames['None']['en'] = 'RichMorinBot' > ^^^^ Some people hate 2-stroke engines; all those unpredictable power bands. If that's you, there's plenty of 4-stroke action. Paul -- Paul Makepeace .............................. http://paulm.com/inchoate/ "If you have a spare bowel,pass it over, then my bra is too small." -- http://paulm.com/toys/surrealism/ From parallax99 at hotmail.com Wed Apr 12 10:51:31 2006 From: parallax99 at hotmail.com (S A) Date: Wed, 12 Apr 2006 10:51:31 -0700 Subject: [sf-perl] localtime bug Message-ID: Anyone else have trouble with localtime behaving funny? For some odd reason Time::Local is an hour off when it interprets this particular set of numbers [samshey at amshey samshey]$ cat test #!/usr/local/bin/perl -w use strict; use Time::Local; #timelocal($secs, $mins, $hrs, $day, $month, $year) my $time_start = timelocal(40, 59, 03, 02, 03, 06); # 3:59:40 my $time_end = timelocal(33, 00, 04, 02, 03, 06); # 4:00:33 print "localtimes:\n"; print "timelocal start: $time_start (= " . localtime($time_start) . ")\n"; print "timelocal end: $time_end (= " . localtime($time_end) . ")\n"; print "gm times:\n"; print "timelocal start: $time_start (= " . gmtime($time_start) . ")\n"; print "timelocal end: $time_end (= " . gmtime($time_end) . ")\n"; exit; [samshey at amshey samshey]$ perl test localtimes: timelocal start: 1143979180 (= Sun Apr 2 04:59:40 2006) timelocal end: 1143975633 (= Sun Apr 2 04:00:33 2006) gm times: timelocal start: 1143979180 (= Sun Apr 2 11:59:40 2006) timelocal end: 1143975633 (= Sun Apr 2 11:00:33 2006) [samshey at amshey samshey]$ perl -v This is perl, v5.8.8 built for i686-linux-thread-multi Copyright 1987-2006, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. [samshey at amshey samshey]$ So strange.... /S - Stefan Amshey parallax99 at hotmail.com From rdm at cfcl.com Wed Apr 12 12:04:04 2006 From: rdm at cfcl.com (Rich Morin) Date: Wed, 12 Apr 2006 11:04:04 -0800 Subject: [sf-perl] localtime bug In-Reply-To: References: Message-ID: At 10:51 AM -0700 4/12/06, S A wrote: > Anyone else have trouble with localtime behaving funny? Sounds like an OS configuration issue, having to do with Daylight Savings Time. -r -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm at cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841 Technical editing and writing, programming, and web development From ray at warmroom.com Wed Apr 12 14:54:28 2006 From: ray at warmroom.com (Ray Baxter) Date: Wed, 12 Apr 2006 14:54:28 -0700 Subject: [sf-perl] localtime bug In-Reply-To: References: Message-ID: <443D7714.6030407@warmroom.com> Rich Morin wrote: > At 10:51 AM -0700 4/12/06, S A wrote: > >> Anyone else have trouble with localtime behaving funny? >> > > Sounds like an OS configuration issue, having to do with > Daylight Savings Time. > Perhaps I am a chronic OS mis-configurer, but I get the same result on Mac OS X 10.4.6, FreeBSD 5.4, Red Hat Linux 2.4.21-4.EL, and Windows XP sp 2. Ray From parallax99 at hotmail.com Wed Apr 12 14:55:16 2006 From: parallax99 at hotmail.com (S A) Date: Wed, 12 Apr 2006 14:55:16 -0700 Subject: [sf-perl] localtime bug In-Reply-To: Message-ID: Ah, yes, this is a leap year... you're probably right. Thanks! /S - Stefan Amshey parallax99 at hotmail.com >From: Rich Morin >Reply-To: San Francisco Perl Mongers User Group >To: San Francisco Perl Mongers User Group >Subject: Re: [sf-perl] localtime bug >Date: Wed, 12 Apr 2006 11:04:04 -0800 > >At 10:51 AM -0700 4/12/06, S A wrote: > > Anyone else have trouble with localtime behaving funny? > >Sounds like an OS configuration issue, having to do with >Daylight Savings Time. > >-r >-- >http://www.cfcl.com/rdm Rich Morin >http://www.cfcl.com/rdm/resume rdm at cfcl.com >http://www.cfcl.com/rdm/weblog +1 650-873-7841 > >Technical editing and writing, programming, and web development >_______________________________________________ >SanFrancisco-pm mailing list >SanFrancisco-pm at pm.org >http://mail.pm.org/mailman/listinfo/sanfrancisco-pm From rdm at cfcl.com Wed Apr 12 16:33:32 2006 From: rdm at cfcl.com (Rich Morin) Date: Wed, 12 Apr 2006 15:33:32 -0800 Subject: [sf-perl] localtime bug In-Reply-To: References: Message-ID: At 10:51 AM -0700 4/12/06, S A wrote: > [samshey at amshey samshey]$ cat test > #!/usr/local/bin/perl -w > ... > [samshey at amshey samshey]$ perl -v > This is perl, v5.8.8 built for i686-linux-thread-multi > ... These are not guaranteed to use the same copy of perl. Use: > #!/usr/bin/env perl > > use strict; > use warnings; Running your code, I get the same results. I think this may be inconsistent handling of DST in the different routines. File a bug report... > my $time_start = timelocal(40, 59, 03, 02, 03, 06); # 3:59:40 It's not a problem here, but putting leading zeros on numbers, in Perl, indicates that they are in octal (base 8) format. So, using them on decimal numbers is not a good habit to get into. -r -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm at cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841 Technical editing and writing, programming, and web development From ray at warmroom.com Thu Apr 13 00:52:30 2006 From: ray at warmroom.com (Ray Baxter) Date: Thu, 13 Apr 2006 00:52:30 -0700 Subject: [sf-perl] localtime bug In-Reply-To: References: Message-ID: <443E033E.4030503@warmroom.com> S A wrote: > Anyone else have trouble with localtime behaving funny? For some odd > reason Time::Local is an hour off when it interprets this particular set of > numbers > > [samshey at amshey samshey]$ cat test > #!/usr/local/bin/perl -w > > use strict; > use Time::Local; > > #timelocal($secs, $mins, $hrs, $day, $month, $year) > my $time_start = timelocal(40, 59, 03, 02, 03, 06); # 3:59:40 > my $time_end = timelocal(33, 00, 04, 02, 03, 06); # 4:00:33 > > print "localtimes:\n"; > print "timelocal start: $time_start (= " . localtime($time_start) . ")\n"; > print "timelocal end: $time_end (= " . localtime($time_end) . ")\n"; > > print "gm times:\n"; > print "timelocal start: $time_start (= " . gmtime($time_start) . ")\n"; > print "timelocal end: $time_end (= " . gmtime($time_end) . ")\n"; > > exit; > [samshey at amshey samshey]$ perl test > localtimes: > timelocal start: 1143979180 (= Sun Apr 2 04:59:40 2006) > timelocal end: 1143975633 (= Sun Apr 2 04:00:33 2006) > gm times: > timelocal start: 1143979180 (= Sun Apr 2 11:59:40 2006) > timelocal end: 1143975633 (= Sun Apr 2 11:00:33 2006) > If you initialize timelocal using either a three-, or four-digit year, the results are correct. Try either my $time_start = timelocal(40, 59, 03, 02, 03, 2006); my $time_start = timelocal(40, 59, 3, 2, 3, 106); I believe this is another instance of a reported bug, with the opposite http://rt.cpan.org/Public/Bug/Display.html?id=11662 Ray From ray at warmroom.com Thu Apr 13 01:27:36 2006 From: ray at warmroom.com (Ray Baxter) Date: Thu, 13 Apr 2006 01:27:36 -0700 Subject: [sf-perl] localtime bug In-Reply-To: <443E033E.4030503@warmroom.com> References: <443E033E.4030503@warmroom.com> Message-ID: <443E0B78.5070801@warmroom.com> Ray Baxter wrote: > S A wrote: > >> Anyone else have trouble with localtime behaving funny? For some odd >> reason Time::Local is an hour off when it interprets this particular set of >> numbers >> >> [samshey at amshey samshey]$ cat test >> #!/usr/local/bin/perl -w >> >> use strict; >> use Time::Local; >> >> #timelocal($secs, $mins, $hrs, $day, $month, $year) >> my $time_start = timelocal(40, 59, 03, 02, 03, 06); # 3:59:40 >> my $time_end = timelocal(33, 00, 04, 02, 03, 06); # 4:00:33 >> >> print "localtimes:\n"; >> print "timelocal start: $time_start (= " . localtime($time_start) . ")\n"; >> print "timelocal end: $time_end (= " . localtime($time_end) . ")\n"; >> >> print "gm times:\n"; >> print "timelocal start: $time_start (= " . gmtime($time_start) . ")\n"; >> print "timelocal end: $time_end (= " . gmtime($time_end) . ")\n"; >> >> exit; >> [samshey at amshey samshey]$ perl test >> localtimes: >> timelocal start: 1143979180 (= Sun Apr 2 04:59:40 2006) >> timelocal end: 1143975633 (= Sun Apr 2 04:00:33 2006) >> gm times: >> timelocal start: 1143979180 (= Sun Apr 2 11:59:40 2006) >> timelocal end: 1143975633 (= Sun Apr 2 11:00:33 2006) >> If you grab the latest Time::Local from cpan, this bug is fixed. [ray at stork ray]$ perl test localtimes: timelocal start: 1143975580 (= Sun Apr 2 03:59:40 2006) timelocal end: 1143975633 (= Sun Apr 2 04:00:33 2006) gm times: timelocal start: 1143975580 (= Sun Apr 2 10:59:40 2006) Ray From rdm at cfcl.com Wed Apr 19 13:32:22 2006 From: rdm at cfcl.com (Rich Morin) Date: Wed, 19 Apr 2006 13:32:22 -0700 Subject: [sf-perl] Calendar of Bay Area Scripting Events Message-ID: I maintain a list of local scripting-related groups: SF Bay Area Scripting Groups http://www.cfcl.com/rdm/bass/groups.php as well as an iCalendar service: webcal://cfcl.com/dav_icpub/BA_Scripting_Groups.ics Additions and corrections would be most welcome! This message is brought to you by The Beer & Scripting SIG http://www.cfcl.com/rdm/bass -r -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm at cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841 Technical editing and writing, programming, and web development From rdm at cfcl.com Wed Apr 19 16:18:04 2006 From: rdm at cfcl.com (Rich Morin) Date: Wed, 19 Apr 2006 16:18:04 -0700 Subject: [sf-perl] Calendar of Bay Area Scripting Events Message-ID: I got a bug report (Thanks, Akbar!) about my iCalendar entry not working with Google Calendar, as: Could not fetch the url because robots.txt prevents us from crawling the url. Looking over our robots.txt file, and using this nifty tool: http://tool.motoricerca.info/robots-checker.phtml I found that we had neglected to include trailing slashes on our lines, so a partial match was getting treated as a full one. I also found that the Google won't accept URLs that begin with "webcal://". Sigh. After editing the URL and the file, however, I found that Google STILL wasn't able (or at least, willing :-/) to download the file. So, I copied the file to a different directory: http://cfcl.com/tmp/BA_Scripting_Groups.ics Google accepts this, leading me to believe that that (a) they have a bug in their handling of robots.txt entries or (b) the old entry is stuck in a cache somewhere. Anyway, this URL should work for now, giving me some time to get a better answer... -r -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm at cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841 Technical editing and writing, programming, and web development From qw at sf.pm.org Thu Apr 20 20:05:20 2006 From: qw at sf.pm.org (Quinn Weaver) Date: Thu, 20 Apr 2006 20:05:20 -0700 Subject: [sf-perl] Reminder: Tuesday, Jeff Thalhammer on Perl::Critic Message-ID: <20060421030520.GA21286@fu.funkspiel.org> This is a reminder that our next meeting is this coming Tuesday. Jeff is the author of Perl::Critic, and he'll be presenting it. Jeff writes: Looking ahead, Barclays Global Investors will host the next SFPM meeting on Tuesday, April 25. I will be presenting Perl::Critic, which is static source code analyzer based on Damian Conway's book "Perl Best Practices." See http://search.cpan.org/dist/Perl-Critic for more details. Since Jeff works at BGI, he is handling RSVPs. Please mail him at Jeff.Thalhammer at barclaysglobal.com; don't mail me! Hope to see you there, -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From qw at sf.pm.org Tue Apr 25 14:55:02 2006 From: qw at sf.pm.org (Quinn Weaver) Date: Tue, 25 Apr 2006 14:55:02 -0700 Subject: [sf-perl] Food update (Reminder: Tuesday, Jeff Thalhammer on Perl::Critic) Message-ID: <20060425215502.GA93504@fu.funkspiel.org> A quick update: Jeff has again come through with sponsorship from BGI for food. I'll order North Indian this time, unless there are objections. Thanks, Jeff; you guys rock. :) -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut