Re: number generator

2007-03-13 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > > It should be possible to enumerate all sets of five numbers which sum > > to 50 and randomly select one of them. > > Of course it's possible. It's also a very inefficient way of doing so. For > five numbers between 1 and 50, there are 50**5 = 312,500

Re: number generator

2007-03-13 Thread Steven D'Aprano
On Tue, 13 Mar 2007 20:42:17 -0700, [EMAIL PROTECTED] wrote: > It should be possible to enumerate all sets of five numbers which sum > to 50 and randomly select one of them. Of course it's possible. It's also a very inefficient way of doing so. For five numbers between 1 and 50, there are 50**5 =

Re: number generator

2007-03-13 Thread Paul Rubin
Paul Rubin writes: > # yield all partitions of n having length k, with many duplications > def _partitions(n,k): > if k==0: return > for i in xrange(1,n-k+1): > for p in partitions(n-i, k-1): > yield (i,)+p Bah, I manag

Re: how to detect change of list of instances

2007-03-13 Thread manstey
Thanks. All I want to know is whether the newlist, as a list of instances, is modified. I thought equality was the way to go, but is there a simpler way? How can I monitor the state of newlist and set a flag if it is changed in anyway? -- http://mail.python.org/mailman/listinfo/python-list

Re: Twelve Proofs that Muhammad is a True Prophet

2007-03-13 Thread Michael Bentley
On Mar 14, 2007, at 12:09 AM, moslim wrote: > My brothers and sisters everywhere! With this essay, I am not singling > out the adherents of Islam - to which I ascribe - but rather I am > writing this essay to every man and woman throughout the whole world. > ... > You know, at first I didn't rea

Re: python/C++ wrapper

2007-03-13 Thread Roman Yakovenko
On 13 Mar 2007 21:55:55 -0700, Frank <[EMAIL PROTECTED]> wrote: > > Hi, > > is there anyone here that calls C++ programs from python via swig? It > seems that there are a lot of different ways to do that. For me it > would be important that the original c++ code (which is available) > does not need

Re: help developing an editor to view openoffice files.

2007-03-13 Thread Paul Hummer
krishnakant Mane wrote: > hello, > well what I exactly need to do is firstly have a way to read .odt and > .ods files. > I have a lot of information in open office format which I need to access. > The most important thing is that I completely want to avoid the use of > microsoft office. > so I need

Re: Problem I have with a while loop/boolean/or

2007-03-13 Thread Scott David Daniels
Bart Willems wrote: > ... > I always try to stay away from 'negative' operators if possible, to > improve readability: > > while True: >hint = raw_input('\nAre you stuck? y/n: ').lower() >if hint = 'y' or hint = 'n': > break >else: > print 'Please answer yes or no' And if

Re: help developing an editor to view openoffice files.

2007-03-13 Thread krishnakant Mane
hello, well what I exactly need to do is firstly have a way to read .odt and .ods files. I have a lot of information in open office format which I need to access. The most important thing is that I completely want to avoid the use of microsoft office. so I need to firstly get access to open office

python/C++ wrapper

2007-03-13 Thread Frank
Hi, is there anyone here that calls C++ programs from python via swig? It seems that there are a lot of different ways to do that. For me it would be important that the original c++ code (which is available) does not need to be changed and the whole compilation process (swig - python g++e

Re: number generator

2007-03-13 Thread [EMAIL PROTECTED]
It should be possible to enumerate all sets of five numbers which sum to 50 and randomly select one of them. Cheers, -T -- http://mail.python.org/mailman/listinfo/python-list

Re: Questions on migrating from Numeric/Scipy to Numpy

2007-03-13 Thread Robert Kern
vj wrote: >> Note that the mask needs to be a bool array. > mask = zeros(5) mask = zeros(5, numpy.int8) mask[1] = True mask[2] = True a = zeros(5) a[mask] = [100, 200] a > array([ 100., 100.,0.,0.,0.]) > > I found this strange. It should just give a

Re: Questions on migrating from Numeric/Scipy to Numpy

2007-03-13 Thread vj
> Note that the mask needs to be a bool array. >>> mask = zeros(5) >>> mask = zeros(5, numpy.int8) >>> mask[1] = True >>> mask[2] = True >>> a = zeros(5) >>> a[mask] = [100, 200] >>> a array([ 100., 100.,0.,0.,0.]) I found this strange. It should just give an error if you try to use

Re: Questions on migrating from Numeric/Scipy to Numpy

2007-03-13 Thread Robert Kern
vj wrote: >> It is just a redirection to the [EMAIL PROTECTED] list. If you just >> tried in the past hour or so, I've discovered that our DNS appears to be down >> right now. > > I tried registering the twice the last couple of days and never got an > email back. Hmm. Odd. I just tried to regist

Re: Eureka moments in Python

2007-03-13 Thread Jeff McNeil
Bit of a newbie on this list, but here goes... Web Services. The company I'm working for has been pretty big into the WS-* specifications and the Microsoft .Net WCF components for our business systems. I'm one of three Unix guys that code the products while we've a larger team of Windows develop

Re: Questions on migrating from Numeric/Scipy to Numpy

2007-03-13 Thread vj
> It is just a redirection to the [EMAIL PROTECTED] list. If you just > tried in the past hour or so, I've discovered that our DNS appears to be down > right now. I tried registering the twice the last couple of days and never got an email back. > No, that's not what insert() does. See the docstr

Re: number generator

2007-03-13 Thread Dick Moores
At 06:20 PM 3/13/2007, Paul Rubin wrote: >Dick Moores <[EMAIL PROTECTED]> writes: > > I understand what zip() and random.sample() are doing, and the above > > helps me get inside the fencepost method, but I don't understand WHY > > it works, or how in the world anyone could have devised it. It is >

Re: number generator

2007-03-13 Thread Duncan Smith
greg wrote: > Gabriel Genellina wrote: > >> The 5th number is not "random". > > > More precisely, the fifth number is not *independent* > of the others. You can't have five independent random > numbers that sum to 50; only four independent numbers > plus a dependent one. > > -- > Greg In the

Re: Problem I have with a while loop/boolean/or

2007-03-13 Thread hg
hg wrote: > [EMAIL PROTECTED] wrote: > >> Hi all. >> >> I have a problem with some code :( >> >> --- >> >> hint = raw_input("\nAre you stuck? y/n: ") >> hint = hint.lower() >> >> while (hint != 'n') or (hint != 'y'): >> hint = raw_input("Please specify a valid choice: ") >> >> --

Re: Problem I have with a while loop/boolean/or

2007-03-13 Thread hg
[EMAIL PROTECTED] wrote: > Hi all. > > I have a problem with some code :( > > --- > > hint = raw_input("\nAre you stuck? y/n: ") > hint = hint.lower() > > while (hint != 'n') or (hint != 'y'): > hint = raw_input("Please specify a valid choice: ") > > --

Re: how to detect change of list of instances

2007-03-13 Thread Steven D'Aprano
On Tue, 13 Mar 2007 18:23:24 -0700, manstey wrote: > how do I detect a change in a list of class instances? > > from copy import deepcopy > > class CaListOfObj(list): > """ subclass of list """ > def __init__(self, *args, **kwargs): > list.__init__(self, *args, **kwargs) > > cla

Re: Questions on migrating from Numeric/Scipy to Numpy

2007-03-13 Thread Robert Kern
vj wrote: > I've tried to post this to the numpy google group but it seems to be > down. It is just a redirection to the numpy-discussion@scipy.org list. If you just tried in the past hour or so, I've discovered that our DNS appears to be down right now. > My migration seems to be going well. I c

Re: number generator

2007-03-13 Thread Duncan Smith
Hendrik van Rooyen wrote: > "Nick Craig-Wood" <[EMAIL PROTECTED]> wrote: > > >>Paul Rubin wrote: >> >>> The fencepost method still seems to be simplest: >>> >>> t = sorted(random.sample(xrange(1,50), 4)) >>> print [(j-i) for i,j in zip([0]+t, t+[50])] >> >>Mmm, nice. >> >>Here is anothe

Re: number generator

2007-03-13 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > Me too. Although Alex Martelli's algorithm: > > map([random.randrange(5) for i in xrange(45)].count, xrange(5)) > > (each value needs adjusting up by one) really boggles my brain. I'm going > to have to think about that. Heh, that is woefully ineffic

Re: Eureka moments in Python

2007-03-13 Thread Ben Finney
"Steven D'Aprano" <[EMAIL PROTECTED]> writes: > I'd be interested in hearing people's stories of Eureka moments in > Python, moments where you suddenly realise that some task which > seemed like it would be hard work was easy with Python. I don't recall the exact context, but Python was the langu

Re: number generator

2007-03-13 Thread Steven D'Aprano
On Tue, 13 Mar 2007 08:20:49 +0200, Hendrik van Rooyen wrote: > Is it possible to devise a test that can distinguish between sets > of: > > - five random numbers that add to 50, and > - four random numbers and a fudge number that add to 50? > > My stats are way too small and rusty to attempt to

how to detect change of list of instances

2007-03-13 Thread manstey
how do I detect a change in a list of class instances? from copy import deepcopy class CaListOfObj(list): """ subclass of list """ def __init__(self, *args, **kwargs): list.__init__(self, *args, **kwargs) class CaClass(object): pass class CaData(object): pass myclass=Ca

Questions on migrating from Numeric/Scipy to Numpy

2007-03-13 Thread vj
I've tried to post this to the numpy google group but it seems to be down. My migration seems to be going well. I currently have one issue with using scipy_base.insert. >>> a = zeros(5) >>> mask = zeros(5) >>> mask[1] = 1 >>> c = zeros(1) >>> c[0] = 100 >>> numpy.insert(a, mask, c) array([ 100.,

Re: number generator

2007-03-13 Thread Paul Rubin
Dick Moores <[EMAIL PROTECTED]> writes: > I understand what zip() and random.sample() are doing, and the above > helps me get inside the fencepost method, but I don't understand WHY > it works, or how in the world anyone could have devised it. It is > truly magical to me! It's Gerald Flanagan's te

Re: number generator

2007-03-13 Thread Steven D'Aprano
On Tue, 13 Mar 2007 17:53:41 -0700, Dick Moores wrote: > At 05:47 PM 3/10/2007, Paul Rubin wrote: > >>The fencepost method still seems to be simplest: >> >> t = sorted(random.sample(xrange(1,50), 4)) >> print [(j-i) for i,j in zip([0]+t, t+[50])] > > = > M

Re: Problem I have with a while loop/boolean/or

2007-03-13 Thread Bart Willems
John McMonagle wrote: > Try it a different way: > > while True: > hint = raw_input("\nAre you stuck? y/n: ") > hint = hint.lower() > if hint != 'y' and hint != 'n': > print "Please answer y or n" > continue > else: > break > if hint == 'y': > do_your_hin

RE: list of dictionary in embedded Python

2007-03-13 Thread ZiZi Zhao
You are right! I added Py_INCREF(pDict); right behind pDict = PyDict_New(); it seems to work correctly. thanks, zz -Original Message- From: [EMAIL PROTECTED] on behalf of Gabriel Genellina Sent: Thu 3/8/2007 7:15 PM To: python-list@python.org Subject: Re: list of dictionary in embedde

Re: help!! *extra* tricky web page to extract data from...

2007-03-13 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > I especially like the rems and conditions they ask you to acknowledge > if you want to sign up as a worker: >http://www.captchasolver.com/join/worker# Heh, cute, I guess you have to solve a different type of puzzle to read them. I'm surprised anyone

Re: number generator

2007-03-13 Thread Dick Moores
At 05:47 PM 3/10/2007, Paul Rubin wrote: >The fencepost method still seems to be simplest: > > t = sorted(random.sample(xrange(1,50), 4)) > print [(j-i) for i,j in zip([0]+t, t+[50])] = M = 50 N = 4 def sumRndIntRubin(M, N): import random t = sort

Re: help!! *extra* tricky web page to extract data from...

2007-03-13 Thread Steve Holden
Paul Rubin wrote: > "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: >> Obviously this wouldn't really help, as you can't predict what a >> website actually wants which events, in possibly which >> order. Especially if the site does not _want_ to be scrapable- think >> of a simple "click on the image

Re: Tools for GUI/graphics

2007-03-13 Thread Erik Johnson
> You can use ReportLab Graphics to generate the > graphs as .JPG files and display them in a > browser window with simple HTML. That is one option. As best as I recall, CherryPy is a simple but fully functional web framework. If your primary focus is programmatically generating graphs from d

Re: number generator

2007-03-13 Thread greg
Gabriel Genellina wrote: > The 5th number is not "random". More precisely, the fifth number is not *independent* of the others. You can't have five independent random numbers that sum to 50; only four independent numbers plus a dependent one. -- Greg -- http://mail.python.org/mailman/listinfo/py

Re: struct.pack oddity

2007-03-13 Thread Steve Holden
Dave Opstad wrote: > In article <[EMAIL PROTECTED]>, > "Erik Johnson" <[EMAIL PROTECTED]> wrote: > >> Barring anyone else disagreeing with classifying it as a bug, I would >> suggest reporting it. Proper procedure for reporting a bug appears to be >> covered in section B of the Python Library

Re: Problem in importing fipy

2007-03-13 Thread Larry Bates
[EMAIL PROTECTED] wrote: > Hi, > > I am using fipy for solving an ODE on python. > > I am getting an error in the line: "from fipy.meshes.grid1D import > Grid1D", which says: > ImportError: No module named fipy.meshes.grid1D > Importing only fipy also gives a similar error. > > I have Python2.4.

Problem in importing fipy

2007-03-13 Thread [EMAIL PROTECTED]
Hi, I am using fipy for solving an ODE on python. I am getting an error in the line: "from fipy.meshes.grid1D import Grid1D", which says: ImportError: No module named fipy.meshes.grid1D Importing only fipy also gives a similar error. I have Python2.4.4, numpy, matplotlib and fipy installed on my

Re: help!! *extra* tricky web page to extract data from...

2007-03-13 Thread John Nagle
[EMAIL PROTECTED] wrote: > How extract the visible numerical data from this Microsoft financial > web site? > > http://tinyurl.com/yw2w4h > > If you simply download the HTML file you'll see the data is *not* > embedded in it but loaded from some other file. > > Surely if I can see the data in my

Re: help!! *extra* tricky web page to extract data from...

2007-03-13 Thread Paul Rubin
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > Obviously this wouldn't really help, as you can't predict what a > website actually wants which events, in possibly which > order. Especially if the site does not _want_ to be scrapable- think > of a simple "click on the images in the order of the nu

Re: help!! *extra* tricky web page to extract data from...

2007-03-13 Thread Diez B. Roggisch
Paul Rubin schrieb: > "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: >> Nice idea, but not really helpful in the end. Besides the rather nasty >> parts of the DOMs that make JS programming the PITA it is, I think the >> whole event-based stuff makes this basically impossible. > > Obviously the Pyt

Re: Problem I have with a while loop/boolean/or

2007-03-13 Thread John McMonagle
[EMAIL PROTECTED] wrote: > Hi all. > > I have a problem with some code :( > > --- > > hint = raw_input("\nAre you stuck? y/n: ") > hint = hint.lower() > > while (hint != 'n') or (hint != 'y'): > hint = raw_input("Please specify a valid choice: ") > > ---

Re: Iterating across a filtered list

2007-03-13 Thread Gabriel Genellina
En Tue, 13 Mar 2007 19:12:12 -0300, Arnaud Delobelle <[EMAIL PROTECTED]> escribió: >> py> import re >> py> x = re.compile("ijk") >> py> y = re.compile("ijk") >> py> x is y >> True >> >> Both, separate calls, returned identical results. You can show the >> cache: > > OK I didn't realise this.

Re: Problem I have with a while loop/boolean/or

2007-03-13 Thread [EMAIL PROTECTED]
On Mar 13, 10:50 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Hi all. > > > I have a problem with some code :( > > > --- > > > hint = raw_input("\nAre you stuck? y/n: ") > > hint = hint.lower() > > > while (hint != 'n') or (hint != 'y'): > > hint = raw_input

Re: Problem I have with a while loop/boolean/or

2007-03-13 Thread [EMAIL PROTECTED]
On Mar 13, 10:43 pm, Paul Rubin wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > while (hint != 'n') or (hint != 'y'): > > hint = raw_input("Please specify a valid choice: ") > > > - > > > so everytime I run the

Re: Problem I have with a while loop/boolean/or

2007-03-13 Thread Larry Bates
[EMAIL PROTECTED] wrote: > Hi all. > > I have a problem with some code :( > > --- > > hint = raw_input("\nAre you stuck? y/n: ") > hint = hint.lower() > > while (hint != 'n') or (hint != 'y'): > hint = raw_input("Please specify a valid choice: ") > > ---

Re: Problem I have with a while loop/boolean/or

2007-03-13 Thread Paul Rubin
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > while (hint != 'n') or (hint != 'y'): > hint = raw_input("Please specify a valid choice: ") > > - > > so everytime I run the program, and enter my choice as y or n, I'm > told to 'Please Specify a va

Re: help!! *extra* tricky web page to extract data from...

2007-03-13 Thread Paul Rubin
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > Nice idea, but not really helpful in the end. Besides the rather nasty > parts of the DOMs that make JS programming the PITA it is, I think the > whole event-based stuff makes this basically impossible. Obviously the Python interface would need ways

Problem I have with a while loop/boolean/or

2007-03-13 Thread [EMAIL PROTECTED]
Hi all. I have a problem with some code :( --- hint = raw_input("\nAre you stuck? y/n: ") hint = hint.lower() while (hint != 'n') or (hint != 'y'): hint = raw_input("Please specify a valid choice: ") - so everytime I run the program, and

Iterating across a filtered list

2007-03-13 Thread Łukasz Ligowski
Hi, On Tuesday 13 of March 2007 22:16:32 Arnaud Delobelle wrote: > for x in L: > if g(x): > do stuff with f(x) for x in itertools.ifilterfalse(g, L): do stuff Maybe this would be even better? L -- http://mail.python.org/mailman/listinfo/python-list

Re: help!! *extra* tricky web page to extract data from...

2007-03-13 Thread Diez B. Roggisch
Paul Rubin schrieb: > "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: >> Still, some pages are AJAX, you won't be able to scrape them easily >> without analyzing the JS code. > > Sooner or later it would be great to have a JS interpreter written in > Python for this purpose. It would do all the sa

Re: help!! *extra* tricky web page to extract data from...

2007-03-13 Thread Paul Rubin
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > Still, some pages are AJAX, you won't be able to scrape them easily > without analyzing the JS code. Sooner or later it would be great to have a JS interpreter written in Python for this purpose. It would do all the same operations on an HTML/XML D

Re: Parsing Indented Text (like parsing Python)

2007-03-13 Thread alisonken1
On Mar 11, 2:34 am, "Mike Schinkel" <[EMAIL PROTECTED]> wrote: > Hi, > > I'm relatively new to Python but have lots of prior programming experience > as a developer, instructor, and author (ASP/VBScript/SQL Server and > Clipper.) > > -- > -Mike > Schinkelhttp://www.mikeschinkel.com/blogs/http:/

Re: ANN: ActivePython 2.5.0.0 is now available

2007-03-13 Thread Ben Finney
"Wensui Liu" <[EMAIL PROTECTED]> writes: > Is [ActivePython] free of charge? Yes. The only cost is to learn how to quote messages considerately. (Please quote in sequence with what you're responding to, and trim all the lines from the quoted message that aren't directly relevant to your reply.)

Re: Iterating across a filtered list

2007-03-13 Thread Arnaud Delobelle
On Mar 13, 9:31 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 13 Mar 2007 17:19:53 -0300, Arnaud Delobelle > <[EMAIL PROTECTED]> escribió: > > > On Mar 13, 7:36 pm, Paul Rubin wrote: > > >> The re library caches the compiled regexp, I think. > > > That wo

Re: help!! *extra* tricky web page to extract data from...

2007-03-13 Thread Diez B. Roggisch
> It's an AJAX-site. You have to carefully analyze it and see what > actually happens in the javascript, then use that. Maybe something like > the http header plugin for firefox helps you there. ups, obviously I wasn't looking enough at the site. Sorry for the confusion. Still, some pages are

Re: Eureka moments in Python

2007-03-13 Thread Brett g Porter
Dustan wrote: > On Mar 13, 10:05 am, Brett g Porter <[EMAIL PROTECTED]> wrote: >> Steven D'Aprano wrote: >>> I'd be interested in hearing people's stories of Eureka moments in Python, >>> moments where you suddenly realise that some task which seemed like it >>> would be hard work was easy with Pyt

Re: Iterating across a filtered list

2007-03-13 Thread Gabriel Genellina
En Tue, 13 Mar 2007 18:16:32 -0300, Arnaud Delobelle <[EMAIL PROTECTED]> escribió: > On Mar 13, 8:59 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: > [snip] >> def find(self, search): >> search_re = re.compile(search, re.IGNORECASE) >> for result in [self.contacts[name] for name

Re: using python to visit web sites and print the web sites image to files

2007-03-13 Thread [EMAIL PROTECTED]
> The reason I want to do simulation but not just crawling is : we have > to check many web pages' front page to see whether it conform to our > visual standard, e.g, it should put a search box on the top part of > the page. It's tedious for human work. So I want to 'crawl and save > the visual pre

Re: help!! *extra* tricky web page to extract data from...

2007-03-13 Thread Max Erickson
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > How extract the visible numerical data from this Microsoft > financial web site? > > http://tinyurl.com/yw2w4h > > If you simply download the HTML file you'll see the data is *not* > embedded in it but loaded from some other file. > > Surely if I

Re: help!! *extra* tricky web page to extract data from...

2007-03-13 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > How extract the visible numerical data from this Microsoft financial > web site? > > http://tinyurl.com/yw2w4h > > If you simply download the HTML file you'll see the data is *not* > embedded in it but loaded from some other file. > > Surely if I can see the data in

Re: ANN: ActivePython 2.5.0.0 is now available

2007-03-13 Thread Trent Mick
Yes. Wensui Liu wrote: > Is it free of charge? > > On 3/13/07, Trent Mick <[EMAIL PROTECTED]> wrote: >>... >> ActivePython is ActiveState's binary distribution of Python. Builds for >> Windows, Mac OS X, Linux, HP-UX and AIX are made freely available. >>... -- http://mail.python.org/mailman/lis

Re: Iterating across a filtered list

2007-03-13 Thread Gabriel Genellina
En Tue, 13 Mar 2007 17:19:53 -0300, Arnaud Delobelle <[EMAIL PROTECTED]> escribió: > On Mar 13, 7:36 pm, Paul Rubin wrote: >> >> The re library caches the compiled regexp, I think. > > That would surprise me. > How can re.search know that string.lower(search) is the sa

Re: Iterating across a filtered list

2007-03-13 Thread Arnaud Delobelle
On Mar 13, 8:59 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: [snip] > def find(self, search): > search_re = re.compile(search, re.IGNORECASE) > for result in [self.contacts[name] for name in self.contacts if > search_re.match(name)]: > print result I do not see how for

Re: ANN: ActivePython 2.5.0.0 is now available

2007-03-13 Thread Wensui Liu
Is it free of charge? On 3/13/07, Trent Mick <[EMAIL PROTECTED]> wrote: > I'm happy to announce that ActivePython 2.5.0.0 is now available for download > from: > http://www.activestate.com/products/activepython/ > > This is the first release of ActivePython for Python version 2.5. Apologies >

Re: Iterating across a filtered list

2007-03-13 Thread Gabriel Genellina
En Tue, 13 Mar 2007 15:04:50 -0300, Drew <[EMAIL PROTECTED]> escribió: > I'm currently writing a toy program as I learn python that acts as a > simple address book. I've run across a situation in my search function > where I want to iterate across a filtered list. My code is working > just fine, b

help!! *extra* tricky web page to extract data from...

2007-03-13 Thread [EMAIL PROTECTED]
How extract the visible numerical data from this Microsoft financial web site? http://tinyurl.com/yw2w4h If you simply download the HTML file you'll see the data is *not* embedded in it but loaded from some other file. Surely if I can see the data in my browser I can grab it somehow right in a P

Re: Starting Python... some questions

2007-03-13 Thread jezzzz .
All, thank you for your responses. I learned much and made some modifications in my small program. Currently I am attempting to put together a packet that contains a Python message (created using struct.pack) and a Scapy message (Ether()). Having a packet with combined payload from Python and S

Re: ActivePython 2.5.0.0 is now available

2007-03-13 Thread Trent Mick
Bror Johansson wrote: > I did notice the download earlier today and I have installed it on five > Windows-machines (two WinXPPro and three Win2K) and have found one > consistent error. > > Whenever I try Help->Python Manuals from PythonWin I get this errormessage: > > "Internal error in hel

Re: Iterating across a filtered list

2007-03-13 Thread Arnaud Delobelle
On Mar 13, 8:53 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Paul Rubin a écrit : [snip] > > Iterators like that are a new Python feature > > List comps are not that new (2.0 or 2.1 ?): > print "\n".join([contact for name, contact in contacts.items() \ > if search.match

Re: Iterating across a filtered list

2007-03-13 Thread Paul Rubin
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > I don't know if I qualify as a Python traditionalist, but I'm using > Python since the 1.5.2 days, and I usually favor list comps or > generator expressions over old-style loops when it comes to this kind > of operations. I like genexps when they'r

Calling cpp from python/SWIG

2007-03-13 Thread Frank
Hi, I have the following problem: I want to parse an array M1 from python to a cpp function fct which returns an array M2. How can I do this best? Is SWIG appropriate or is there something else? If someone could give some code example or a link to a page with examples, that would be great! Tha

Re: Need help with a string plz! (newbie)

2007-03-13 Thread Bruno Desthuilliers
Grant Edwards a écrit : (snip) > I don't know if emacs still includes Zippy quotes > (of if they've been updated), but you used to be able to do > "esc-X yow" and emacs would show you a random Zippy quote. > It's still there. -- http://mail.python.org/mailman/listinfo/python-list

Re: ActivePython 2.5.0.0 is now available

2007-03-13 Thread Bror Johansson
"Trent Mick" <[EMAIL PROTECTED]> skrev i meddelandet news:[EMAIL PROTECTED] > I'm happy to announce that ActivePython 2.5.0.0 is now available for > download > from: > http://www.activestate.com/products/activepython/ > > This is the first release of ActivePython for Python version 2.5. > A

Re: struct.pack oddity

2007-03-13 Thread Dave Opstad
In article <[EMAIL PROTECTED]>, "Erik Johnson" <[EMAIL PROTECTED]> wrote: > Barring anyone else disagreeing with classifying it as a bug, I would > suggest reporting it. Proper procedure for reporting a bug appears to be > covered in section B of the Python Library Reference: > http://docs.py

Re: Iterating across a filtered list

2007-03-13 Thread Arnaud Delobelle
On Mar 13, 7:36 pm, Paul Rubin wrote: > "Arnaud Delobelle" <[EMAIL PROTECTED]> writes: > > in the for loop. Moreover you recalculate the regexp for each element > > of the list. > > The re library caches the compiled regexp, I think. That would surprise me. How can re.s

Re: Iterating across a filtered list

2007-03-13 Thread Bruno Desthuilliers
Paul Rubin a écrit : > "Drew" <[EMAIL PROTECTED]> writes: > >>You're exactly on the mark. I guess I was just wondering if your first >>example (that is, breaking the if statement away from the iteration) >>was preferred rather than initially filtering and then iterating. > > > I think the multip

Getting a service's banner by connect to a port

2007-03-13 Thread mmcgee00
Hi, Currently, I am trying to get different service banner by connecting to different ports using python (code below). The versions I am working with are python 4.2.1 and fedora core 4. I am trying to reproduce a very small piece of nmap, since nmap has to get a port's banner in order to figure

Re: httplib/socket problems reading 404 Not Found response

2007-03-13 Thread Gabriel Genellina
En Tue, 13 Mar 2007 10:38:24 -0300, Patrick Altman <[EMAIL PROTECTED]> escribió: >> Yes, it's a known problem. See this message with a >> self-response:http://mail.python.org/pipermail/python-list/2006-March/375087.html > Are there plans to include this fix in the standard Python libraries >

Re: struct.pack oddity

2007-03-13 Thread Dave Opstad
In article <[EMAIL PROTECTED]>, Larry Bates <[EMAIL PROTECTED]> wrote: > 1) You can't put 10 into a half-word. The limit is 2**16 > or 65535. On Python 2.5 I get: Yes, I know. I used that example to illustrate the problem. If a value does not fit a format then Python should report that con

Re: Single string print statements on multiple lines.

2007-03-13 Thread Gabriel Genellina
En Tue, 13 Mar 2007 08:31:17 -0300, Bruno Desthuilliers <[EMAIL PROTECTED]> escribió: > Obviously, the OP is not trying to cheat (explicitelt > aknowledging it is homework), and has a good enough understanding of > what the usual solution is (asking for the escape char in Python). > > Now of cou

Re: Communicating with a DLL under Linux

2007-03-13 Thread John Nagle
Mikael Olofsson wrote: > I am interested in peoples experience with communicating with DLLs under > Linux. > > Situation: > > I'm an electrical engineer that finds pleasure in using my soldering > iron from time to time. I also find programming, preferably in Python, > entertaining. I wouldn't

ANN: ActivePython 2.5.0.0 is now available

2007-03-13 Thread Trent Mick
I'm happy to announce that ActivePython 2.5.0.0 is now available for download from: http://www.activestate.com/products/activepython/ This is the first release of ActivePython for Python version 2.5. Apologies for the long delay between core Python 2.5 and this release. The good news is that

Re: Setting Up SOAPpy for Python v2.5 on Windows?

2007-03-13 Thread Steven Bethard
Steve wrote: > What are the required version of the SOAPpy, PyXML, fpconst that are > needed to run under the Python 2.5 environment on Windows? If you're not married to SOAPpy, you can use elementsoap which has just a single download and works with ElementTree from the 2.5 stdlib: http://e

Re: help developing an editor to view openoffice files.

2007-03-13 Thread Colin J. Williams
Ken Starks wrote: > krishnakant Mane wrote: >> hello, >> right now I am involved on doing a very important accessibility work. >> as many people may or may not know that I am a visually handicap >> person and work a lot on accessibility. the main issue at hand is to >> create an accessible editor

Re: Iterating across a filtered list

2007-03-13 Thread Paul Rubin
"Arnaud Delobelle" <[EMAIL PROTECTED]> writes: > in the for loop. Moreover you recalculate the regexp for each element > of the list. The re library caches the compiled regexp, I think. -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterating across a filtered list

2007-03-13 Thread Paul Rubin
"Drew" <[EMAIL PROTECTED]> writes: > You're exactly on the mark. I guess I was just wondering if your first > example (that is, breaking the if statement away from the iteration) > was preferred rather than initially filtering and then iterating. I think the multiple statement version is more in P

Re: Iterating across a filtered list

2007-03-13 Thread Arnaud Delobelle
On Mar 13, 6:04 pm, "Drew" <[EMAIL PROTECTED]> wrote: > All - Hi! [snip] > http://pastie.caboo.se/46647 There is no need for such a convoluted list comprehension as you iterate over it immediately! It is clearer to put the filtering logic in the for loop. Moreover you recalculate the regexp for

Re: Starting an external, independent process from a script

2007-03-13 Thread Gabriel Genellina
On 12 Mar 2007 16:13:51 -0700, Henrik Lied <[EMAIL PROTECTED]> wrote: >> I'm trying to create a video uploading service (just to learn). The >> system is mostly based on Django, but the question I'm looking an >> answer for is more related to Python. En Tue, 13 Mar 2007 06:57:33 -0300, rishi path

Re: Tools for GUI/graphics

2007-03-13 Thread Larry Bates
Paulo da Silva wrote: > I need to make some data representation. > Basically a major window for a 2D chart, > a scrollable window with some few small 2D > graphics. The rest is a normal form with > buttons, labels and entries. > > I thought of doing that using Tkinter+pmw+blt. > But now I'm consid

Re: How to capture environment state after running a shell script.

2007-03-13 Thread attn . steven . kuo
On Mar 13, 5:57 am, "Gerard Flanagan" <[EMAIL PROTECTED]> wrote: > Hello, > > I have a third party shell script which updates multiple environment > values, and I want to investigate (and ultimately capture to python) > the environment state after the script has run. But running the script > as a c

Re: Iterating across a filtered list

2007-03-13 Thread Drew
On Mar 13, 2:42 pm, Paul Rubin wrote: > If I can decipher your Ruby example (I don't know Ruby), I think you > want: > >for name,contact in contacts.iteritems(): > if re.search('search', name): > print contact > > If you just want to filter the diction

Setting Up SOAPpy for Python v2.5 on Windows?

2007-03-13 Thread Steve
Hi All, What are the required version of the SOAPpy, PyXML, fpconst that are needed to run under the Python 2.5 environment on Windows? Locations for the downloads? Thanks! Steve -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterating across a filtered list

2007-03-13 Thread Paul Rubin
"Drew" <[EMAIL PROTECTED]> writes: > I'm currently writing a toy program as I learn python that acts as a > simple address book. I've run across a situation in my search function > where I want to iterate across a filtered list. My code is working > just fine, but I'm wondering if this is the most

Re: CD insert/eject detection

2007-03-13 Thread [EMAIL PROTECTED]
I've never used it myself, but pygame (based on SDL - so it should work for MS Windows, Linux, and Apple OSX) has a CD module with some potentially useful functions, CD.eject() and CD.get_empty(). http://www.pygame.org/docs/ref/cdrom.html#pygame.cdrom.CD -sjbrown On Mar 13, 7:54 am, "Mark Bryan

Tools for GUI/graphics

2007-03-13 Thread Paulo da Silva
I need to make some data representation. Basically a major window for a 2D chart, a scrollable window with some few small 2D graphics. The rest is a normal form with buttons, labels and entries. I thought of doing that using Tkinter+pmw+blt. But now I'm considering use a web solution. Is there any

Re: number generator

2007-03-13 Thread Gabriel Genellina
En Tue, 13 Mar 2007 03:20:49 -0300, Hendrik van Rooyen <[EMAIL PROTECTED]> escribió: > Is it possible to devise a test that can distinguish between sets > of: > > - five random numbers that add to 50, and > - four random numbers and a fudge number that add to 50? > > My stats are way too small a

Iterating across a filtered list

2007-03-13 Thread Drew
All - I'm currently writing a toy program as I learn python that acts as a simple address book. I've run across a situation in my search function where I want to iterate across a filtered list. My code is working just fine, but I'm wondering if this is the most "elegant" way to do this. Essentiall

  1   2   >