Re: "Strong typing vs. strong testing"

2010-10-03 Thread guthrie
An interesting archive article on the topic of correctness, and the layers thereof: Program verification: the very idea; Communications of the ACM Volume 31 , Issue 9 (September 1988) Pages: 1048 - 1063 Year of Publication: 1988 ISSN:0001-0782 "The notion of program verificatio

Dynamically compiling and reloading SWIG .pyd file

2010-05-11 Thread Dave Guthrie
I am creating an application which has it's code split between python and C. The Python is used to provide a high level GUI interface and the C is for low level functions. I use SWIG to create Python Bindings for the C functions. I want to implement a feature where there is a button in the toolbar

python interface to Yahoo groups?

2009-12-29 Thread guthrie
I'm looking for something to monitor & download yahoo group messages using Python, similar to the Perl module WWW::Yahoo::Groups. I've seen a few comments (speculations?) that Yahoo groups uses Python code, but couldn't find any examples of samples of such access tools. Any references or pointers

Re: py-rrdTool - install fails

2009-08-14 Thread guthrie
On Aug 14, 3:39 pm, Christian Heimes wrote: > guthrie schrieb: > > > > > I want to do some rrd in a python cgi script, but am having trouble > > getting an easy install module. > > > py-rrdTool looks good, but is distributed in c source, and is missing > >

py-rrdTool - install fails

2009-08-14 Thread guthrie
h': No such file or directory error: command '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN \cl.exe"' failed with exit status 2 C:\Documents and Settings\guthrie\Desktop\py-rrdtool-0.2.1> -- http://mail.python.org/mailman/listinfo/python-list

run all scripts in sub-directory as subroutines?

2009-08-11 Thread guthrie
I want to have a program which will form a list of all *.py scripts in a sub-directory, and then call some standard messages on them. So I can add a new data source modularly by just dropping a new file into the sources directory with the appropriate methods in it. For example: path = sys.path[0]

Re: generator expression works in shell, NameError in script

2009-06-21 Thread guthrie
On Jun 18, 11:28 pm, greg wrote: > nn wrote: > > This is certainly an odd one. This code works fine under 2.6 but fails > > in Python 3.1. > > class x: > > > ...     lst=[2] > > ...     gen=[lst.index(e) for e in lst] > > In 3.x it was decided that the loop variables in a list > comprehension

Re: generator expression works in shell, NameError in script

2009-06-18 Thread guthrie
On Jun 17, 6:38 pm, Steven Samuel Cole wrote: > Still don't really understand why my initial code didn't work, though... Your code certainly looks reasonable, and looks to me like it "should" work. The comment of partial namespace is interesting, but unconvincing (to me) - but I am not a Python e

Re: python list pattern matching?

2009-05-28 Thread guthrie
Many thanks to all; perfect solution! -- http://mail.python.org/mailman/listinfo/python-list

python list pattern matching?

2009-05-28 Thread guthrie
I want to do a functional like pattern match to get teh first two elements, and then the rest of an array return value. For example, assume that perms(x) returns a list of values, and I want to do this: seq=perms(x) a = seq[0] b = seq[1] rest = seq[2:] Of course I can shorten to:

Re: list comprehension syntax..?

2006-08-01 Thread Gregory Guthrie
Very helpful, thanks!! So I see that it parses as: m='1' a="asdf" b="1234" print [((m in a) or b) for m in '%d'%1234 ] I get it. Thanks, Greg "Duncan Booth" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Gre

list comprehension syntax..?

2006-08-01 Thread Gregory Guthrie
Sorry for a simple question- but I don't understand how to parse this use of a list comprehension. The "or" clauses are odd to me. It also seems like it is being overly clever (?) in using a lc expression as a for loop to drive the recursion. Thanks for any insight! Gregory ---

Re: Language Design: list_for scope?

2006-07-21 Thread guthrie
Larry Bates wrote: > First things first: > > Don't name a variable "dict" because if you do it shadows > the built in dict function (same goes for list, str, ...). > This WILL bite you later, so start now by not naming > variables by any built in names. -- Thanks, got it! > > Now to your quest

Language Design: list_for scope?

2006-07-21 Thread guthrie
I'm pretty new to Python, and trying to parse the grammar. Q: What is the scope of the testlist in a list_for? For example; Instead of; for x in [ x in dict if dict[x]=="thing" ]: in this: for x in dict and dict[x]=="thing": x is undefined. And why doesn't this work: for x in

Re: array slice of [:-0] ??

2006-07-18 Thread guthrie
Thanks all!! - guthrie wrote: > Beginner question! :-) > > x=[1,2,3,4] > for i in range(len(x)): >print x[:-i] > > >>> [] > >>> [1,2,3] > >>> [1,2] > >>> [1] > > 1) The x[:-0] result seems in

array alice of [:-0] ??

2006-07-18 Thread guthrie
Beginner question! :-) x=[1,2,3,4] for i in range(len(x)): print x[:-i] >>> [] >>> [1,2,3] >>> [1,2] >>> [1] 1) The x[:-0] result seems inconsistent to me; I get the idea that -0=0, so it is taken as x[:0] -> [] 2) how then should one do this basic left-recursive subsetting (easily)

Re: language design question

2006-07-09 Thread guthrie
top of the library. Anyway, I get your point, thanks. Greg Steven Bethard wrote: > guthrie wrote: > >> Steven Bethard wrote: >> >>> Why would ``x.len()`` be any more convenient than ``len(x)``? Your >>> preference here seems pretty arbitrary. >>

Re: language design question

2006-07-09 Thread guthrie
Many thanks; great information. Best, Gregory Steven Bethard wrote: > guthrie wrote: > >> Steven Bethard wrote: >> >>> Why would ``x.len()`` be any more convenient than ``len(x)``? Your >>> preference here seems pretty arbitrary. >> >> -- Per

Re: language design question

2006-07-09 Thread guthrie
Steven Bethard wrote: > Gregory Guthrie wrote: > >> For example, >>- why is len() not a member function of strings? Instead one says >> len(w). > > Why would ``x.len()`` be any more convenient than ``len(x)``? Your > preference here seems pretty arbi

language design question

2006-07-09 Thread Gregory Guthrie
I am comparing Python to a few other scripting languages, and used a simple anagrams program as a sample. I was surprised ast a few python features that did not work as I would expect/wish; which caused less compact/expressive program styles that I wanted - reverting to a FORTRAN like series of