Re: problem with array and for loop

2006-05-10 Thread Robert Kern
Fabian Braennstroem wrote: > Hi Robert, > > * Robert Kern <[EMAIL PROTECTED]> wrote: >>Are you aware that numpy array indices start with 0, not 1? >> >>You will probably want to ask numpy questions on the numpy-discussion mailing >>list: >> >> http://www.scipy.org/Mailing_Lists > > I thought a

Re: problem with array and for loop

2006-05-10 Thread Fabian Braennstroem
Hi Robert, * Robert Kern <[EMAIL PROTECTED]> wrote: > Fabian Braennstroem wrote: >> Hi, >> >> I have a 'simple' problem with a multidimension array in a >> for loop. It looks like this: >> >> wert= zeros([127,2]) >> wert1= zeros(127) >> m=1 >> l=1 >> >> for pos in [pos1,pos2,pos3]: >> for

Re: python sqlite3 api question

2006-05-10 Thread [EMAIL PROTECTED]
Ah, je comprend. Thanks for pointing that out to me - I'll just have to spend more time at the code face to get the job done. Many thanks, Lol -- http://mail.python.org/mailman/listinfo/python-list

2 books for me

2006-05-10 Thread Gary Wessle
Hi I am about to order 2 books, and thought I should talk to you first. I am getting Python Cookbook by Alex Martelli, David Ascher, Anna Martelli Ravenscroft, Anna Martelli Ravenscroft, since Bruce Eckel's Thinking in Python is not finished and didn't have any new revisions since some time in 200

Re: python rounding problem.

2006-05-10 Thread Tim Roberts
"chun ping wang" <[EMAIL PROTECTED]> wrote: > >Hey i have a stupid question. > >How do i get python to print the result in only three decimal place... > >Example>>> round (2.9954254, 3) >2.9951 > >but i want to get rid of all trailing 0's..how would i do that? Your "problem" is

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread M Jared Finder
Chris Uppal wrote: > E.g. can you add three-way comparisons (less-than, same-as, greater-than to, > say, Python with corresponding three-way conditional control structures to > supplement "if" etc ? Are they on a semantic and syntactic par with the > existing ones ? In Smalltalk that is trivial

Re: problem with array and for loop

2006-05-10 Thread Robert Kern
Fabian Braennstroem wrote: > Hi, > > I have a 'simple' problem with a multidimension array in a > for loop. It looks like this: > > wert= zeros([127,2]) > wert1= zeros(127) > m=1 > l=1 > > for pos in [pos1,pos2,pos3]: > for i in range(1,125): > wert[l,m]= > probe1.GetOutput().GetPo

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread M Jared Finder
Alex Martelli wrote: > M Jared Finder <[EMAIL PROTECTED]> wrote: >... >> Your reasoning, taken to the extreme, implies that an assembly language, >> by virtue of having the fewest constructs, is the best designed language > > Except that the major premise is faulty! Try e.g. >

Python and windows bandwidth statistics?

2006-05-10 Thread Dave Reid
I've been searching for a something in Python for me to be able to get the total outbound or inbound bandwidth (in Windows (or cross-OS compatible). Can anyone help me out? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

problem with array and for loop

2006-05-10 Thread Fabian Braennstroem
Hi, I have a 'simple' problem with a multidimension array in a for loop. It looks like this: wert= zeros([127,2]) wert1= zeros(127) m=1 l=1 for pos in [pos1,pos2,pos3]: for i in range(1,125): wert[l,m]= probe1.GetOutput().GetPointData().GetScalars().GetTuple1(i); #wert1[i]=

Re: glob() that traverses a folder tree

2006-05-10 Thread seannakasone
# i'm guessing os.walk() is the best way to traverse folder trees. import os, glob for dir, subdir, files in os.walk('.\InteropSolution'): for file in files: if glob.fnmatch.fnmatch(file,"*.dll") or glob.fnmatch.fnmatch(file,"*.exe"): print dir+file -- http://mail.python.org/m

Re: 345 free programming books

2006-05-10 Thread Tim
Anyone has any free books to submit? -- http://mail.python.org/mailman/listinfo/python-list

Re: data entry tool

2006-05-10 Thread Serge Orlov
[EMAIL PROTECTED] wrote: > If the data to be entered is simple and textual you can even think > about using a text only interface. The resulting program will be really > simple, and probably good enough. FWIW here is size of "Hello, world!" program distribution using different interfaces: text co

Re: Nested loops confusion

2006-05-10 Thread Matthew Graham
Oops, I forget to reset the j after the inner loop. Always manage to work these things out just after asking for help! ;-) Matthew Graham wrote: > Hi, > > I expect this is very obvious for anyone who knows what they're doing - > but I don't understand what's the problem with the following code

Nested loops confusion

2006-05-10 Thread Matthew Graham
Hi, I expect this is very obvious for anyone who knows what they're doing - but I don't understand what's the problem with the following code. I was intending that the program cycle through all i and j (ie. all possible (i,j) coordinates, but the output when I run the program shows me up to

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Ken Tilton
Alex Martelli wrote: > Stefan Nobis <[EMAIL PROTECTED]> wrote: > > >>[EMAIL PROTECTED] (Alex Martelli) writes: >> >> >>>if anonymous functions are available, they're used in even more >>>cases where naming would help >> >>Yes, you're right. But don't stop here. What about expressions? Many >>pe

Re: segmentation fault in scipy?

2006-05-10 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Im using rprop (not dependent on error function in this case ie. > standard rprop vs. irprop or arprop) for an MLP tanh, sigmod nnet as > part of a hybrid model. I guess I was using a little Matlab thought > when I wrote the SSE funtion. My batches are about 25,000 x 80

Re: New tail recursion decorator

2006-05-10 Thread Carl Banks
Michele Simionato wrote: > CONTINUE = object() # sentinel value returned by iterfunc > > def tail_recursive(func): > """ > tail_recursive decorator based on Kay Schluehr's recipe > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691 > """ > var = dict(in_loop=False,

Re: segmentation fault in scipy?

2006-05-10 Thread conor . robinson
Im using rprop (not dependent on error function in this case ie. standard rprop vs. irprop or arprop) for an MLP tanh, sigmod nnet as part of a hybrid model. I guess I was using a little Matlab thought when I wrote the SSE funtion. My batches are about 25,000 x 80 so my absolute error (diff betwee

Formmating excel cells with PyExcelerator or COM

2006-05-10 Thread Mauricio Tellez
Hi, I just want that a number like 1234.123 appear in excel as 1,234.12In excel I just select some cells, then right click on them and select "Cell Formatting" then select Number, and check "Use thounsands separator" and 2 decimal places. I can't find how to do this with PyExcelerator neither with

Re: reusing parts of a string in RE matches?

2006-05-10 Thread BartlebyScrivener
Thanks, Ben. Quite an education! rick -- http://mail.python.org/mailman/listinfo/python-list

Re: data entry tool

2006-05-10 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: >Peter wrote>Wow - why so big for such a simple tool? 2MB sounds like a >LOT of coding.< > >Yes, it's a lot of code, but it's code written by other people (Python, >Tkinter). Using Tkinter your program will probably be quite short, even >i

Re: reusing parts of a string in RE matches?

2006-05-10 Thread Ben Cartwright
Murali wrote: > > Yes, and no extra for loops are needed! You can define groups inside > > the lookahead assertion: > > > > >>> import re > > >>> re.findall(r'(?=(aba))', 'abababababababab') > > ['aba', 'aba', 'aba', 'aba', 'aba', 'aba', 'aba'] > > Wonderful and this works with any regexp, s

Re: Econometrics in Panel data?

2006-05-10 Thread N/A
Oh! I think I should stop wasting time to learn Python to do my econometric algorithms. >_< [EMAIL PROTECTED] wrote: > Cameron Laird wrote: >> In article <[EMAIL PROTECTED]>, I counseled: >>> In article <[EMAIL PROTECTED]>, >>> DeepBlue <[EMAIL PROTECTED]> wrote: so are you saying that Pyt

Re: hyperthreading locks up sleeping threads

2006-05-10 Thread Grant Edwards
On 2006-05-10, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Grant > >> You might want to run some memory tests. > > We have multiple identical boxes and they all have the same problem. Maybe whoever built them got a bad batch of RAM. Or maybe the just used RAM with the wrong specs. It doesn't

Re: reusing parts of a string in RE matches?

2006-05-10 Thread Murali
> Yes, and no extra for loops are needed! You can define groups inside > the lookahead assertion: > > >>> import re > >>> re.findall(r'(?=(aba))', 'abababababababab') > ['aba', 'aba', 'aba', 'aba', 'aba', 'aba', 'aba'] Wonderful and this works with any regexp, so import re def all_occuren

Slow network reading?

2006-05-10 Thread Ivan Voras
I have a simple network protocol client (it's a part of this: http://sqlcached.sourceforge.net) implemented in Python, PHP and C. Everything's fine, except that the Python implementation is the slowest - up to 30% slower than the PHP version (which implements exactly the same logic, in a class)

Re: New tail recursion decorator

2006-05-10 Thread Felipe Almeida Lessa
Em Ter, 2006-05-09 às 23:30 -0700, Kay Schluehr escreveu: > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691 Is it thread safe? -- Felipe. -- http://mail.python.org/mailman/listinfo/python-list

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Alex Martelli
Joe Marshall <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > Joe Marshall <[EMAIL PROTECTED]> wrote: > >... > > > The problem is that a `name' is a mapping from a symbolic identifier to > > > an object and that this mapping must either be global (with the > > > attendant name collision i

glob() that traverses a folder tree

2006-05-10 Thread seannakasone
i'm looking for something like glob.glob() that traverses sub-directories. is there anything like that? i guess i'm looking for something to replace the unix find command. -- http://mail.python.org/mailman/listinfo/python-list

Re: Econometrics in Panel data?

2006-05-10 Thread beliavsky
Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, I counseled: > >In article <[EMAIL PROTECTED]>, > >DeepBlue <[EMAIL PROTECTED]> wrote: > >>so are you saying that Python is not an appropriate language for doing > >>econometrics stuff? > >> > >> > >>Dennis Lee Bieber wrote: > >>> On Tue, 09 M

Re: reusing parts of a string in RE matches?

2006-05-10 Thread Ben Cartwright
John Salerno wrote: > So my question is, how can find all occurrences of a pattern in a > string, including overlapping matches? I figure it has something to do > with look-ahead and look-behind, but I've only gotten this far: > > import re > string = 'abababababababab' > pattern = re.compile(r'ab(

Re: create a c++ wrapper for python class?

2006-05-10 Thread Diez B. Roggisch
Mark Harrison schrieb: > Right now I'm using Boost Python to wrap some C++ code so > that applications from both languages can use it. > > This is great, but I'm rapidly coming to the conclusion that > a lot of this work is better coded in Python. There's nothing > particularly CPU-bound, and the

Re: Best form when using matrices and arrays in scipy...

2006-05-10 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Using large arrays of data I found it is MUCH faster to cast arrays to > matricies and then multiply the two matricies togther > (scipy.matrix(ARRAY1)*scipy.matrix(ARRAY2)) in order to do a matrix > multipy of two arrays vs. scipy.matrixmultipy(ARRAY1, ARRAY2). > > Are t

Re: segmentation fault in scipy?

2006-05-10 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Good point. Finding the SSE using an absolute error matrix of (25000 x > 1) is insane. I pulled out the error function (for now) and I'm back > in business. Thanks for all the great advise. Could you go back for a second and describe your problem a little bit more. It

Best form when using matrices and arrays in scipy...

2006-05-10 Thread conor . robinson
Using large arrays of data I found it is MUCH faster to cast arrays to matricies and then multiply the two matricies togther (scipy.matrix(ARRAY1)*scipy.matrix(ARRAY2)) in order to do a matrix multipy of two arrays vs. scipy.matrixmultipy(ARRAY1, ARRAY2). Are there any logical/efficiency errors w

create a c++ wrapper for python class?

2006-05-10 Thread Mark Harrison
Right now I'm using Boost Python to wrap some C++ code so that applications from both languages can use it. This is great, but I'm rapidly coming to the conclusion that a lot of this work is better coded in Python. There's nothing particularly CPU-bound, and the comprehensive Python library is a

Re: Memory leak in Python

2006-05-10 Thread diffuser78
I ran simulation for 128 nodes and used the following oo = gc.get_objects() print len(oo) on every time step the number of objects are increasing. For 128 nodes I had 1058177 objects. I think I need to revisit the code and remove the referencesbut how to do that. I am still a newbie coder an

Re: segmentation fault in scipy?

2006-05-10 Thread conor . robinson
Good point. Finding the SSE using an absolute error matrix of (25000 x 1) is insane. I pulled out the error function (for now) and I'm back in business. Thanks for all the great advise. -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory leak in Python

2006-05-10 Thread diffuser78
With 1024 nodes it runs fine...but takes around4 hours to run on AMD 3100. -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory leak in Python

2006-05-10 Thread diffuser78
Sure, are there any available simulators...since i am modifying some stuff i thought of creating one of my own. But if you know some exisiting simlators , those can be of great help to me. Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: segmentation fault in scipy?

2006-05-10 Thread Robert Kern
[EMAIL PROTECTED] wrote: > I'm running operations large arrays of floats, approx 25,000 x 80. > Python (scipy) does not seem to come close to using 4GB of wired mem, > but segments at around a gig. Everything works fine on smaller batches > of data around 10,000 x 80 and uses a max of ~600mb of mem

Re: hyperthreading locks up sleeping threads

2006-05-10 Thread David Reed
On May 10, 2006, at 5:39 PM, [EMAIL PROTECTED] wrote: > Grant > >> You might want to run some memory tests. > > We have multiple identical boxes and they all have the same problem. > > Olaf They might all have flaky memory - I would follow the other poster's advice and run memtest86 on them.

Re: segmentation fault in scipy?

2006-05-10 Thread conor . robinson
If I run it from the shell (unix) I get: Segmentation fault and see a core dump in my processes. If I run it in the python shell I get as above: File "D:\Python24\Lib\site-packages\numpy\core\defmatrix.py", line 149, in __mul__ return N.dot(self, other) MemoryError I your experience as one of

Re: syntax for -c cmd

2006-05-10 Thread Paul McGuire
"James" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Wrong syntax is shown below. What should be the delimiter before else? > > python -c 'if 1==1: print "yes"; else print "no"' > > James > So you can approximate this same logic with a boolean expression: print (1==1 and "yes" or

Re: Calling C/C++ functions in a python script

2006-05-10 Thread Ravi Teja
If all you have are functions, the easiest is to create a simple dll/so and load it into Python with ctypes. http://starship.python.net/crew/theller/ctypes/tutorial.html For more advanced needs, take a look at some of the extending options available. http://www.suttoncourtenay.org.uk/duncan/accu/i

Re: segmentation fault in scipy?

2006-05-10 Thread Travis E. Oliphant
[EMAIL PROTECTED] wrote: > I'm running operations large arrays of floats, approx 25,000 x 80. > Python (scipy) does not seem to come close to using 4GB of wired mem, > but segments at around a gig. Everything works fine on smaller batches > of data around 10,000 x 80 and uses a max of ~600mb of mem

Re: interactive shell -- reload definitions?

2006-05-10 Thread Metalone
Thanks everybody. -- http://mail.python.org/mailman/listinfo/python-list

Calling C/C++ functions in a python script

2006-05-10 Thread chaosquant
I'm kind of beginner in Python, so I must ask what are probably silly questions. Here is my problem: I have a static library say, a file library.lib, which can be linked to C or C++ programs. Now I would like to use the functions of the library in Python script, under Win XP. Can someone give m

segmentation fault in scipy?

2006-05-10 Thread conor . robinson
I'm running operations large arrays of floats, approx 25,000 x 80. Python (scipy) does not seem to come close to using 4GB of wired mem, but segments at around a gig. Everything works fine on smaller batches of data around 10,000 x 80 and uses a max of ~600mb of mem. Any Ideas? Is this just too m

Re: installing numpy

2006-05-10 Thread Robert Kern
Gary Wessle wrote: > thanks > I followed your suggestions, it built the package ok, while it was > building, I noticed lots of lines going by the screen in groups of > different colors, white, yellow, red. > the red got my attention: > > > Could not locate executable gfortran > C

Re: design a Condition class

2006-05-10 Thread Paul McGuire
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > i posted for suggestions a little idea even if it still needs further > thoughts but as i'm sure you could help :) > > if would like to implement some kind of Condition class which i coud > use to build bricks of more complex

Re: installing numpy

2006-05-10 Thread Gary Wessle
thanks I followed your suggestions, it built the package ok, while it was building, I noticed lots of lines going by the screen in groups of different colors, white, yellow, red. the red got my attention: Could not locate executable gfortran Could not locate executable f95 *

Re: combined files together

2006-05-10 Thread Gary Wessle
Eric Deveaud <[EMAIL PROTECTED]> writes: > Gary Wessle wrote: > > > > I need to traverse those files in the order they were created > > chronologically. listdir() does not do it, is there a way besides > > build a list then list.sort(), then for element in list_of_files open > > element? > >

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Frank Goenninger DG1SBG
Ken Tilton <[EMAIL PROTECTED]> writes: > sross wrote: >>>I do wonder what would happen to Cells if I ever want to support >>>multiple threads. Or in a parallel processing environment. >> AFAIK It should be fine. >> In LW, SBCL and ACL all bindings of dynamic variables are thread-local. >> > > Ah,

Re: design a Condition class

2006-05-10 Thread Carl J. Van Arsdall
[EMAIL PROTECTED] wrote: > Hello, > > i posted for suggestions a little idea even if it still needs further > thoughts but as i'm sure you could help :) > > if would like to implement some kind of Condition class which i coud > use to build bricks of more complex condition, conditions are based o

design a Condition class

2006-05-10 Thread joh12005
Hello, i posted for suggestions a little idea even if it still needs further thoughts but as i'm sure you could help :) if would like to implement some kind of Condition class which i coud use to build bricks of more complex condition, conditions are based on fields by using regexp class Conditi

Re: hyperthreading locks up sleeping threads

2006-05-10 Thread OlafMeding
Grant > You might want to run some memory tests. We have multiple identical boxes and they all have the same problem. Olaf -- http://mail.python.org/mailman/listinfo/python-list

Re: ConfigParser and multiple option names

2006-05-10 Thread Florian Lindner
[EMAIL PROTECTED] wrote: > that will break horribly in windows, remenber it install all it's crap > in c:\Program Files Why should this break? If you split at the \n character? Florian -- http://mail.python.org/mailman/listinfo/python-list

Re: Can Python installation be as clean as PHP?

2006-05-10 Thread Peter Maas
Jack wrote: > With Python, things are really messy. I have to run the installer > to install dozens of directories and hundreds of files, and I don't > really know if all of them are necessary. PHP has LOTS of functions in a single namespace. I don't know wether they are in separate files or pack

Re: hyperthreading locks up sleeping threads

2006-05-10 Thread Grant Edwards
On 2006-05-10, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > So to make sure that no other software is involved we took the > PC with the problem, reset the BIOS to its defaults (which > also enables hyper-threading) and installed Windows XP > Professional (SP2) on it (but no further driver softw

Re: hyperthreading locks up sleeping threads

2006-05-10 Thread OlafMeding
This is an update on what we found so far: We located one other PC that was not identical to the PC with the problem. So we installed Windows XP on it and ran the Python test program. It ran fine all night w/o locking up. Here is what winmsd reports for this PC: winmsd: OS Name: Microsoft Windo

Re: data entry tool

2006-05-10 Thread bearophileHUGS
Peter wrote>Wow - why so big for such a simple tool? 2MB sounds like a LOT of coding.< Yes, it's a lot of code, but it's code written by other people (Python, Tkinter). Using Tkinter your program will probably be quite short, even if you use some dbase. If the data to be entered is simple and text

Re: reusing parts of a string in RE matches?

2006-05-10 Thread mpeters42
Exactly, Now this will work as long as there are no wildcards in the pattern. Thus, only with fixed strings. But if you have a fixed string, there is really no need to use regex, as it will complicate you life for no real reason (as opposed to simple string methods). With a more complex pattern

Re: data entry tool

2006-05-10 Thread Dan Sommers
On Thu, 11 May 2006 06:54:14 +1200, Peter <[EMAIL PROTECTED]> wrote: > Serge Orlov wrote: [ ... ] >> Keep in mind that standalone application for windows will be about >> 2Mb. > Wow - why so big for such a simple tool? > 2MB sounds like a LOT of coding. Actually, just the opposite: that's 2MB

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Chris F Clark
Kenny replied to me saying: > Yep. But with Cells the dependency graph is just a shifting record of > who asked who, shifting because all of a sudden some outlier data will > enter the system and a rule will branch to code for the first time, > and suddenly "depend on" on some new other cell (new a

Re: MySQLdb trouble

2006-05-10 Thread Nicolay A. Vasiliev
Hi! I use the DB connection from many application modules. In fact, I test some technic hardly on the local machine. When I get coming result I upload the script to the web server. I have 2 functions: connect_db and loc_connect_db. First contains the remote server login data, second - local se

Re: reusing parts of a string in RE matches?

2006-05-10 Thread Kent Johnson
John Salerno wrote: > I probably should find an RE group to post to, but my news server at > work doesn't seem to have one, so I apologize. But this is in Python > anyway :) > > So my question is, how can find all occurrences of a pattern in a > string, including overlapping matches? You can

can distutils windows installer invoke another distutils windows installer

2006-05-10 Thread timw.google
Hi all. I have a package that uses other packages. I created a setup.py to use 'try:' and import to check if some required packages are installed. I have the tarballs and corresponding windows installers in my sdist distribution, so if I untar my source distribution and do 'python setup.py install

Re: reusing parts of a string in RE matches?

2006-05-10 Thread John Salerno
John Salerno wrote: > [EMAIL PROTECTED] wrote: > > string = 'abababababababab' > pat = 'aba' > [pat for s in re.compile('(?='+pat+')').findall(string)] >> ['aba', 'aba', 'aba', 'aba', 'aba', 'aba', 'aba'] > > Wow, I have no idea how to read that RE. First off, what does it match? > S

Re: reusing parts of a string in RE matches?

2006-05-10 Thread John Salerno
[EMAIL PROTECTED] wrote: string = 'abababababababab' pat = 'aba' [pat for s in re.compile('(?='+pat+')').findall(string)] > ['aba', 'aba', 'aba', 'aba', 'aba', 'aba', 'aba'] Wow, I have no idea how to read that RE. First off, what does it match? Should something come before the pa

[ANN] tdir 1.69 Released And Available

2006-05-10 Thread Tim Daneliuk
'tdir' Version 1.69 is released and available at: http://www.tundraware.com/Software/tdir/ A FreeBSD port update has also been submitted. What's New -- This version introduces the -D option which supresses "dotfile/dir" display. What Is 'tdir'? --- 'tdir' is a reimple

Re: reusing parts of a string in RE matches?

2006-05-10 Thread BartlebyScrivener
>> otherwise i might as well just use string >> methods I think you're supposed to use string methods if you can, to avoid the old adage about having two problems instead of one when using regex. rd -- http://mail.python.org/mailman/listinfo/python-list

Re: data entry tool

2006-05-10 Thread Peter
Serge Orlov wrote: > Peter wrote: >> A webapp isn't feasible as most of the users are on dial up (this is in >> New Zealand and broadband isn't available for lots of people). > > I don't see connection here, why it's not feasible? Our volunteers won't sit on their dial up connection for hours at

Re: reusing parts of a string in RE matches?

2006-05-10 Thread mpeters42
>From the Python 2.4 docs: findall( pattern, string[, flags]) Return a list of all ***non-overlapping*** matches of pattern in string By design, the regex functions return non-overlapping patterns. Without doing some kind of looping, I think you are out of luck. If you pattern is fixed,

Re: syntax for -c cmd

2006-05-10 Thread Simon Brunning
On 5/10/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > James wrote: > > > Wrong syntax is shown below. What should be the delimiter before else? > > > > python -c 'if 1==1: print "yes"; else print "no"' > > there is no such delimiter. Python's syntax doesn't allow you to put multiple > clauses on

Re: Masked arrays

2006-05-10 Thread Robert Kern
Tommy Grav wrote: > I am trying to get the flux of a star in an image. I have been using numpy > and pyfits and have the code. You will probably want to ask on numpy-discussion, instead. http://www.scipy.org/Mailing_Lists > def distance(im,xc,yc): > (rows,cols) = im.shape > dist = zer

Re: reusing parts of a string in RE matches?

2006-05-10 Thread John Salerno
BartlebyScrivener wrote: > I have to at least try :) > > s = "abababababababab" > > for x in range(len(s)): > ... try: > ... s.index("aba", x, x + 3) > ... except ValueError: > ... pass > > rd > yeah, looks like index() or find() can be used to do it instead of RE, but

Re: multiline strings and proper indentation/alignment

2006-05-10 Thread Dave Hansen
On Wed, 10 May 2006 15:50:38 GMT in comp.lang.python, John Salerno <[EMAIL PROTECTED]> wrote: >Dave Hansen wrote: > > print textwrap.dedent(s).strip().replace('\n',' ') >> this is a multiline triple-quted string with indentation for nicer >> code formatting > >But I have some newlines that are

PyThreadState_SetAsyncExc, PyErr_Clear and boost::python

2006-05-10 Thread gabriel . becedillas
I use PyThreadState_SetAsyncExc to stop a python thread but there are situations when the thread doesn't stop and continues executing normally. After some debugging, I realized that the problem is that PyThreadState_SetAsyncExc was called when the thread was inside a native extension, that for some

Re: syntax for -c cmd

2006-05-10 Thread Fredrik Lundh
James wrote: > Wrong syntax is shown below. What should be the delimiter before else? > > python -c 'if 1==1: print "yes"; else print "no"' there is no such delimiter. Python's syntax doesn't allow you to put multiple clauses on a single line. if your shell supports it, use a "here document", o

Re: Python's DSLs (was: A critic of Guido's blog on Python's lambda)

2006-05-10 Thread aaronwmail-usenet
Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Alex Martelli <[EMAIL PROTECTED]> wrote: ... . > >Of course, the choice of Python does mean that, when we really truly > >need a "domain specific little language", we have to implement it as a > >language in its own right,

Re: python sqlite3 api question

2006-05-10 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > is it possible to pass args through the api which are the same as the > args you can use on the sqlite3 command line? > What I'm talking about is the .mode or .output commands which you can > enter via the sqlite3 cli so I can dynamically change were the output > goes.

syntax for -c cmd

2006-05-10 Thread James
Wrong syntax is shown below. What should be the delimiter before else? python -c 'if 1==1: print "yes"; else print "no"' James -- http://mail.python.org/mailman/listinfo/python-list

Masked arrays

2006-05-10 Thread Tommy Grav
I am trying to get the flux of a star in an image. I have been using numpy and pyfits and have the code.def distance(im,xc,yc):    (rows,cols) = im.shape    dist = zeros([rows,cols]).astype(Float64)    for row in range(rows):        for col in range(cols):            dist[row,col] = sqrt(((row + 0.

Re: unittest: How to fail if environment does not allow execution?

2006-05-10 Thread Roy Smith
Kai Grossjohann <[EMAIL PROTECTED]> wrote: > I wrote a test case that depends on a certain file existing in the > environment. In theory, unit tests should not depend on any external factors, but we all know the difference between theory and practice, right? > So, I guess I should test that the

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Robert Uhl
Ken Tilton <[EMAIL PROTECTED]> writes: > > Set Kelvin, and make Celsius and Fahrneheit functions of that. Or Rankine:-) -- Robert Uhl Brought to you by 'Ouchies', the sharp, prickly toy you bathe with... -- http://mail.python.org/mailman/listinfo/python-list

Re: help with Linker dependencies missing went compiling mysql-python on Windows without VisualStudio

2006-05-10 Thread Jorge Vargas
noone here has try this??On 5/8/06, Jorge Vargas <[EMAIL PROTECTED]> wrote: Hi everyone I'm stuck at doing this and can't find the problem, maybe someone with more experience then I compiling python can help me out. I google around and found some old articles, from them the one that seems more accu

Re: Multi-line lambda proposal.

2006-05-10 Thread Kaz Kylheku
Antoon Pardon wrote: > Could you give me an example. Suppose I have the following: > > def arg_range(inf, sup): > > def check(f): > > def call(arg): > if inf <= arg <= sup: > return f(arg) > else: > raise ValueError > > return call > > return check def arg_r

Re: reusing parts of a string in RE matches?

2006-05-10 Thread BartlebyScrivener
I have to at least try :) s = "abababababababab" for x in range(len(s)): ... try: ... s.index("aba", x, x + 3) ... except ValueError: ... pass rd -- http://mail.python.org/mailman/listinfo/python-list

Re: interactive shell -- reload definitions?

2006-05-10 Thread Jack Diederich
On Wed, May 10, 2006 at 10:00:38AM -0700, malv wrote: > This is a question that comes up almost continuously for at least six > years now. > For Python users having to deal with major real-life applications, this > may make them think twice about the future suitability of Python as a > competitive

Re: Is Welfare Part of Capitalism?

2006-05-10 Thread Dr. Who
Technically, I would call it a manfesto. The manifesto module is probably the most facinating module in Python since it's the only one whose functions consist entirely of doc strings followed by a pass and do no useful work. Jeff Tim Daneliuk wrote: > [EMAIL PROTECTED] wrote: > > This article is

python sqlite3 api question

2006-05-10 Thread [EMAIL PROTECTED]
Hi, is it possible to pass args through the api which are the same as the args you can use on the sqlite3 command line? What I'm talking about is the .mode or .output commands which you can enter via the sqlite3 cli so I can dynamically change were the output goes. Ta -- http://mail.python.org/ma

Re: Python's regular expression?

2006-05-10 Thread Dave Hughes
Dave Hansen wrote: > On Wed, 10 May 2006 06:44:27 GMT in comp.lang.python, Edward Elliott > <[EMAIL PROTECTED]> wrote: > > > > > > Would I recommend perl for readable, maintainable code? No, not > > when better options like Python are available. But it can be done > > with some effort. > > I

unittest: How to fail if environment does not allow execution?

2006-05-10 Thread Kai Grossjohann
I wrote a test case that depends on a certain file existing in the environment. So, I guess I should test that the file exists in the setUp method. But what if it doesn't exist? How do I fail in that case? I would like to emit an error message explaining what is wrong. tia, Kai -- http://mail

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread jayessay
"Michele Simionato" <[EMAIL PROTECTED]> writes: > jayessay wrote: > > "Michele Simionato" <[EMAIL PROTECTED]> writes: > > > > > Ken Tilton wrote: > > > > I was not thinking about the thread issue (of which I know little). The > > > > big deal for Cells is the dynamic bit: > > > > > > > > (let

Re: Can Python installation be as clean as PHP?

2006-05-10 Thread Edward Elliott
XBello wrote: > It's possible to work with php just with these single file? Maybe I'm > doing the wrong thing, because to start to program I needed to install > a web server too (a large bunch of files). PHP can be run from the command line too. On ubuntu/debian it's available by installing the

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Joe Marshall
Alex Martelli wrote: > Joe Marshall <[EMAIL PROTECTED]> wrote: >... > > The problem is that a `name' is a mapping from a symbolic identifier to > > an object and that this mapping must either be global (with the > > attendant name collision issues) or within a context (with the > > attendant q

Re: interactive shell -- reload definitions?

2006-05-10 Thread malv
This is a question that comes up almost continuously for at least six years now. For Python users having to deal with major real-life applications, this may make them think twice about the future suitability of Python as a competitive development tool. Ruby is featuring a software modify and go fea

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Boris Borcic
Ken Tilton wrote: > > > Boris Borcic wrote: >> Ken Tilton wrote: >> >>> "Now if you are like most people, you think that means X. It does not." >> >> >> As far as natural language and understanding are concerned, "to mean" >> means conformity to what most people understand, Humpty Dumpties >> n

  1   2   3   >