Re: newbie: minidom

2006-11-17 Thread Uche Ogbuji
Paul Watson wrote: > Explicit [XML declaration] is better than implicit. Yes indeed. "Always use an XML declaration" http://www-128.ibm.com/developerworks/xml/library/x-tipdecl.html -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.nethttp://fo

Re: lxml/ElementTree and .tail

2006-11-17 Thread Uche Ogbuji
Fredrik Lundh wrote: > Chas Emerick wrote: > > If I'm wrong, just chalk it up to the fact that this is the first > > time I've ever looked at the Infoset spec, and I'm simply confused. > > the Infoset spec *is* the essence of XML; if you don't realize that an > XML document is just a serialization

Re: Secure Python

2006-11-17 Thread Hendrik van Rooyen
"Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote - 5 times - must be record for stupidity... sorry about this - the message was stuck in my outbox for some reason, and I hit the send key multiple times, not noticing that it was in fact being sent... - Hendrik -- http://mail.python.org/mailman/lis

Re: How can I speed this function up?

2006-11-17 Thread Paddy
Chris wrote: > I have a vested interest in showing a colleague that a python app can > yield results in a time comparable to his C-app, which he feels is mch > faster. I'd like to know what I can do within the constraints of the > python language to get the best speed possible. Hope someone can he

Re: Pb subprocess

2006-11-17 Thread M�ta-MCI
Solved. Thank to Amaury. Solution : change (in register), Command Processor, for to force using of "CMD /U/C" Then, STDOUT is in utf-16 (but win-console stay in cp850) HGD Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: basic python questions

2006-11-17 Thread Paddy
[EMAIL PROTECTED] wrote: > I have a simple assignment for school but am unsure where to go. The > assignment is to read in a text file, split out the words and say which > line each word appears in alphabetical order. I have the basic outline > of the program done which is: > > def Xref(filename):

Re: os.lisdir, gets unicode, returns unicode... USUALLY?!?!?

2006-11-17 Thread Fredrik Lundh
Martin v. Löwis wrote: >> How about returning two lists, first list contains unicode names, the >> second list contains undecodable names: >> >> files, troublesome = os.listdir(separate_errors=True) >> >> and make separate_errors=True by default in python 3.0 ? > > That would be quite an incompat

Re: What do I look for in a shared Python host?

2006-11-17 Thread Gregor Horvath
walterbyrd schrieb: > > What other "gotchas" would I look for? > Maybe this is helpfull for you: http://docs.turbogears.org/1.0/Hosting -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: decompiler

2006-11-17 Thread John Bokma
"jim" <[EMAIL PROTECTED]> wrote: > Is there such thing as a free decompile that I can run in windows xp You asked the same Q in comp.lang.perl.misc... -- John MexIT: http://johnbokma.com/mexit/ personal page: http://johnbokma.com/

Re: How can I speed this function up?

2006-11-17 Thread Tim Hochberg
Chris wrote: > This is just some dummy code to mimic what's being done in the real > code. The actual code is python which is used as a scripting language in > a third party app. The data structure returned by the app is more or > less like the "data" list in the code below. The test for "ELEMEN

basic python questions

2006-11-17 Thread [EMAIL PROTECTED]
I have a simple assignment for school but am unsure where to go. The assignment is to read in a text file, split out the words and say which line each word appears in alphabetical order. I have the basic outline of the program done which is: def Xref(filename): try: fp = open(filename,

Re: pyfits problem

2006-11-17 Thread Cygnus X-1
On Thu, 16 Nov 2006 15:35:00 -0500, Tommy Grav wrote (in article <[EMAIL PROTECTED]>): > I am trying to load in a fits-image and get this error > > wiyn05dec/n1 -> display -i obj062.fits > Traceback (most recent call last): >File "/Users/tgrav/Work/Astronomy/MyCode/Python/Redspit/ > display.

Re: How can I speed this function up?

2006-11-17 Thread Gabriel Genellina
At Friday 17/11/2006 23:40, Chris wrote: This is just some dummy code to mimic what's being done in the real code. The actual code is python which is used as a scripting language in a third party app. The data structure returned by the app is more or less like the "data" list in the code below.

Re: How can I speed this function up?

2006-11-17 Thread Łukasz Langa
Hi, Chris. I made a trivial testing framework for this cute problem and tried a couple of modifications. I also added the 10% of non-ELEMENT lines you mentioned. First thing, your updated algorithm didn't really get me much faster results than the original. I guess that my disk array sort

decompiler

2006-11-17 Thread jim
Is there such thing as a free decompile that I can run in windows xp -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I speed this function up?

2006-11-17 Thread Chris
Chris wrote: > This is just some dummy code to mimic what's being done in the real > code. The actual code is python which is used as a scripting language in > a third party app. The data structure returned by the app is more or > less like the "data" list in the code below. The test for "ELEMEN

Re: How can I speed this function up?

2006-11-17 Thread Terry Reedy
"Chris" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > def write_data1(out, data): > for i in data: > if i[0] is 'ELEMENT': Testing for equality with 'is' is a bit of a cheat since it is implementation dependent, but since you have a somewhat unfair constraint >

How can I speed this function up?

2006-11-17 Thread Chris
This is just some dummy code to mimic what's being done in the real code. The actual code is python which is used as a scripting language in a third party app. The data structure returned by the app is more or less like the "data" list in the code below. The test for "ELEMENT" is necessary ...

What do I look for in a shared Python host?

2006-11-17 Thread walterbyrd
For example: - If I want to use Django, I need either FastCGI or Apache 2.X/mod_python 3.x - if I want to use TurboGears, I need Python 2.4: not 2.3 and not 2.5 - I have just learned that some hosters have T&Cs that forbid long running processes. I am not sure exactly what that means. Except I u

Re: notify on directory changes

2006-11-17 Thread Gabriel Genellina
At Friday 17/11/2006 19:41, Josh wrote: Does python have a way of registering a callback - or through some other mechanism - to notify me when a directory listing has changed, or if a file has been modified, deleted, created, etc.? I'm looking for behavior similar to the .net class FileSystemWat

Re: explicit self revisited

2006-11-17 Thread baalbek
Peter Maas wrote: > No magic. Just a dot. But perhaps a dot is too tiny. We could take JUST_ME > or ME_AND_BOBBY_MCGEE instead, of course as a reserved keyword followed > by a > dot ;) Why a dot, and not a @, like in Ruby and Perl? I think a dot is a particular bad idea, not the least due to po

Re: how to print pdf with python on a inkjet printer.

2006-11-17 Thread Gabriel Genellina
At Friday 17/11/2006 17:40, Tim Roberts wrote: > double wow! as it is my customer wants me to print to the default > printer. > can you please help me with the command for rendering the pdf to the > printer with acrobat using python? You'll have to use the registry to find "acrord32", but once

Re: os.lisdir, gets unicode, returns unicode... USUALLY?!?!?

2006-11-17 Thread Martin v. Löwis
gabor schrieb: > depends on the application. in the one where it happened i would just > display an error message, and tell the admins to check the > filesystem-encoding. > > (in other ones, where it's not critical to get the correct name, i would > probably just convert the text to unicode using

Re: os.lisdir, gets unicode, returns unicode... USUALLY?!?!?

2006-11-17 Thread Martin v. Löwis
Leo Kislov schrieb: > How about returning two lists, first list contains unicode names, the > second list contains undecodable names: > > files, troublesome = os.listdir(separate_errors=True) > > and make separate_errors=True by default in python 3.0 ? That would be quite an incompatible change,

Re: Decimal() instead of float?

2006-11-17 Thread Tim Peters
[Michael B. Trausch] >> Let's say that I want to work with the latitude 33.6907570. In Python, >> that number > can not be stored exactly without the aid of >> decimal.Decimal(). >> >> >>> 33.6907570 >> 33.6907568 >> >>> >> >> As you can see, it loses accuracy after the 6th decimal place.

Re: Python v PHP for web, and restarting Apache?

2006-11-17 Thread sandra . eloff
On Nov 17, 12:07 pm, "walterbyrd" <[EMAIL PROTECTED]> wrote: > I think I have read somewhere that using Python to develop > web-applications requires some restarting of the Apache server, whereas > PHP does not. It depends what you do. CGI's operate much like PHP. mod_python has auto-reloading (an

Re: Why does this code crash python?

2006-11-17 Thread Michael
The reason for your problem is that, at it's core, it's not threadsafe - you have a shared data value that 2 distinct things are trying to update. [EMAIL PROTECTED] wrote: ... > from threading import Thread The following value is updated by 2 things trying to run in parallel. > c = Console.getco

Re: function for allocating memory for string array

2006-11-17 Thread Gabriel Genellina
At Friday 17/11/2006 11:14, Sheldon wrote: Can someone tell me how to remove the conflicts here ? Wrong group! Anyway, there is no need to reinvent the wheel, there are many array libraries for C... -- Gabriel Genellina Softlab SRL __ Corr

Re: Decimal() instead of float?

2006-11-17 Thread Robert Kern
Robert Kern wrote: > Fredrik Lundh wrote: >> Terry Reedy wrote: >> >>> This is far more accurate than any measured latitude could be. >> you're saying that we don't measure geographical positions on an atomic >> scale? ;-) >> >> (it's too late for serious calculations, but I'd guess we're talking

Re: About alternatives to Matlab

2006-11-17 Thread Maarten van Reeuwijk
sturlamolden wrote: > Sorry Mathworks, I have used your product for years, but you cannot > compete with NumPy. Funny. I went exactly the other way. Had a full OO postprocessing library for Python/Scipy/HDF etc which worked brilliantly. Then changed to a 64 bit machine and spent three days trying

Re: dict.reserve and other tricks

2006-11-17 Thread Klaas
[EMAIL PROTECTED] wrote: > Klaas: > > > Well, you can reduce the memory usage to virtually nothing by using a > > generator expression rather than list comprehension. > > Are you sure? I don't think so. Can you show a little example? Sorry, that was boneheaded and wrong. -Mike -- http://mail.py

Re: Decimal() instead of float?

2006-11-17 Thread Robert Kern
Fredrik Lundh wrote: > Terry Reedy wrote: > >> This is far more accurate than any measured latitude could be. > > you're saying that we don't measure geographical positions on an atomic > scale? ;-) > > (it's too late for serious calculations, but I'd guess we're talking > Ångströms here, righ

Re: Inotify on netfilter socket

2006-11-17 Thread Jean-Paul Calderone
On Fri, 17 Nov 2006 22:52:51 +, tom <[EMAIL PROTECTED]> wrote: >Hi Guys, > >I'm wondering if it's possible to set up an inotify watch on a netfilter >socket. I want to monitor for incoming packets to the netfilter QUEUE >target, but I can't seem to do it. select.select works on it, but i >want

Re: Slicing / subsetting list in arbitrary fashion

2006-11-17 Thread Michael Spencer
Gregg Lind wrote: > I wish something like this was part of the standard python installation, > and didn't require one to use Numpy or Numarray. This sort of list > subsetting is useful in many, many contexts. > Many of numpy's multi-dimensional slicing and indexing operations are implemented

Re: Python Parallel Paradigm

2006-11-17 Thread Michael
Sandy wrote: ... > Lots of trees, but where's the Wood? > > Where are concurrency/distributed models compared and discussed? I don't know about wood, but you can find a shrubbery[*] called Kamaelia sitting here: * http://kamaelia.sourceforge.net/Home A basic (albeit now aging) tutorial as t

Re: remove a list from a list

2006-11-17 Thread Rares Vernica
This solution I think is pretty nice: source[:] = [x for x in source if x.lower() not in target] Thanks a lot for all the answers, Ray Steven D'Aprano wrote: > On Fri, 17 Nov 2006 12:00:46 -0800, Rares Vernica wrote: > >> Problem context: >> >> import os >> dirs_exclude = set(('a', 'b', 'e')) >

Re: Decimal() instead of float?

2006-11-17 Thread Fredrik Lundh
Terry Reedy wrote: > This is far more accurate than any measured latitude could be. you're saying that we don't measure geographical positions on an atomic scale? ;-) (it's too late for serious calculations, but I'd guess we're talking Ångströms here, right?) -- http://mail.python.org/mail

Re: remove a list from a list

2006-11-17 Thread Rares Vernica
The problem with skipping over them is that "walk" would still walk them and their content. If they have a lot of other dirs and files inside then this might end up being time consuming. Thanks, Ray Neil Cerutti wrote: > On 2006-11-17, Rares Vernica <[EMAIL PROTECTED]> wrote: >> Sorry for not b

Re: Decimal() instead of float?

2006-11-17 Thread Terry Reedy
"Michael B. Trausch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Let's say that I want to work with the latitude 33.6907570. In Python, > that number > can not be stored exactly without the aid of > decimal.Decimal(). > >>> 33.6907570 > 33.6907568 > >>> > As you can

Re: Decimal() instead of float?

2006-11-17 Thread Ron Adam
Michael B. Trausch wrote: > On Fri, 2006-11-17 at 21:25 +0100, Fredrik Lundh wrote: >> > Some of the lat/long pairs that I have used seem to come out fine, but >> > some do not. Because the mathmatics used with them involve complex >> > equations when determining distance and the like, any error

Inotify on netfilter socket

2006-11-17 Thread tom
Hi Guys, I'm wondering if it's possible to set up an inotify watch on a netfilter socket. I want to monitor for incoming packets to the netfilter QUEUE target, but I can't seem to do it. select.select works on it, but i wanted to use inotify really. Is there any way to create a tangible file

notify on directory changes

2006-11-17 Thread Josh
Hi, Does python have a way of registering a callback - or through some other mechanism - to notify me when a directory listing has changed, or if a file has been modified, deleted, created, etc.? I'm looking for behavior similar to the .net class FileSystemWatcher. I would also be interested to

Re: Decimal() instead of float?

2006-11-17 Thread Fredrik Lundh
Michael B. Trausch wrote: > Sure, I do. Let's say that I want to work with the latitude > 33.6907570. In Python, that number can not be stored exactly without > the aid of decimal.Decimal(). > > >>> 33.6907570 > 33.6907568 > >>> > > As you can see, it loses accuracy after the 6th d

Re: Decimal() instead of float?

2006-11-17 Thread Carsten Haese
On Fri, 2006-11-17 at 16:51 -0500, Michael B. Trausch wrote: > On Fri, 2006-11-17 at 21:25 +0100, Fredrik Lundh wrote: > > > Some of the lat/long pairs that I have used seem to come out fine, but > > > some do not. Because the mathmatics used with them involve complex > > > equations when deter

Re: Decimal() instead of float?

2006-11-17 Thread Robert Kern
Michael B. Trausch wrote: > Perhaps you should not make assumptions; I am sure that you have heard > what they do at some point before. While *some* of the error doesn't > propagate as expected (which is actually a problem in itself—equations > no longer make sense if they are not mathematically b

Re: Decimal() instead of float?

2006-11-17 Thread Carsten Haese
On Fri, 2006-11-17 at 16:51 -0500, Michael B. Trausch wrote: > [...] > Let's say that I want to work with the latitude 33.6907570. In > Python, that number can not be stored exactly without the aid of > decimal.Decimal(). > > >>> 33.6907570 > 33.6907568 You say that like it's Python's fa

Re: Decimal() instead of float?

2006-11-17 Thread Michael B. Trausch
On Fri, 2006-11-17 at 21:25 +0100, Fredrik Lundh wrote: > > Some of the lat/long pairs that I have used seem to come out fine, but > > some do not. Because the mathmatics used with them involve complex > > equations when determining distance and the like, any error gets > > massively compounde

Re: How fuzzy is get_close_matches() in difflib?

2006-11-17 Thread John Machin
On Nov 17, 7:19 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: [snip] > You want to see "HIDEDCT1" match closer to "HIDESCT1" than "HIDEDST1": > > HIDEDCT1 -- John's "best match" target string > HIDEDST1 -- difflib's "best match" target string > HIDESCT1 -- source string > > John's best match ma

Re: how to print pdf with python on a inkjet printer.

2006-11-17 Thread Tim Roberts
krishnakant Mane wrote: >> > double wow! as it is my customer wants me to print to the default > printer. > can you please help me with the command for rendering the pdf to the > printer with acrobat using python? You'll have to use the registry to find "acrord32", but once you find it, you jus

Re: About alternatives to Matlab

2006-11-17 Thread John Henry
Thanks for pointing that out. I wasn't aware of this. Will take a look. Sébastien Boisgérault wrote: > On Nov 16, 10:46 pm, "John Henry" <[EMAIL PROTECTED]> wrote: > > Bill Gates will have you jailed! :-) > > > > On a more serious note, is there any alternative to Simulink though? > > Ptolemy I

Pb subprocess

2006-11-17 Thread M�ta-MCI
Hi! This code : p=subprocess.Popen(chaine, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE) data=p.stdout.read() Run OK, except when stdout.read() give unicode data, with char>255 (this give many "?") How read real unicode data in stdout.read() ? T

Re: Python v PHP: fair comparison?

2006-11-17 Thread [EMAIL PROTECTED]
Luis M. González wrote: > [EMAIL PROTECTED] ha escrito: > > > Luis M. González wrote: > > > OK. But since when has python been considered a viable alternative for > > > web development? > > > As a generalp purpose language, it's older. > > > But as a web development language, it's olnly when people

Re: remove a list from a list

2006-11-17 Thread Steven D'Aprano
On Fri, 17 Nov 2006 12:00:46 -0800, Rares Vernica wrote: > Problem context: > > import os > dirs_exclude = set(('a', 'b', 'e')) > for root, dirs, files in os.walk('python/Lib/email'): > # Task: > # delete from "dirs" the directory names from "dirs_exclude" > # case-insensitive > >

Re: remove a list from a list

2006-11-17 Thread John Henry
OK, if you don't care the resulting order, do it like: class Convert2Dict: def __init__(self, data): self._data={} for x in data: self._data[x.upper()]=x def get(self, key): return self._data[key.upper()] a = ["a", "B"] b = ["c", "a", "A", "D", "b"] b_d

Re: remove a list from a list

2006-11-17 Thread Neil Cerutti
On 2006-11-17, Rares Vernica <[EMAIL PROTECTED]> wrote: > Sorry for not being clear from the beginning and for not using > clear variable names. > > Problem context: > > import os > dirs_exclude = set(('a', 'b', 'e')) > for root, dirs, files in os.walk('python/Lib/email'): > # Task: > # d

Re: Question about unreasonable slowness

2006-11-17 Thread allenjo5
Łukasz Langa wrote: > [EMAIL PROTECTED]: > > Ok, I built Python 2.5 (same AIX 5.1 machine). With the "for line in > > shellOut" loop in, it now takes "only" 7 secs instead of the 11 secs in > > python 2.4.3. So, that's better, but still unreasonably slow. And to > > answer another's question,

Re: Decimal() instead of float?

2006-11-17 Thread Fredrik Lundh
Michael B. Trausch wrote: > I don't have (so far as I know) a 64-bit float available to me. as mentioned in the documentation, Python's "float" datatype is implemented C doubles, which is 64-bit IEEE on all major platforms. > Some of the lat/long pairs that I have used seem to come out fine, bu

Re: remove a list from a list

2006-11-17 Thread Matimus
> The solution so far is: > > for i in xrange(len(dirs), 0, -1): >if dirs[i-1].lower() in dirs_exclude: > del dirs[i-1] This won't affect much, but uses better style I think. Change: for i in xrange(len(dirs),0,-1): To: for i in reversed(xrange(len(dirs))): and then just use 'i' inst

Re: Decimal() instead of float?

2006-11-17 Thread Robert Kern
Michael B. Trausch wrote: > I don't have (so far as I know) a 64-bit float available to me. Yes, you do: the regular Python float type. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as th

Anynoe have any examples on how to use python with paypal?

2006-11-17 Thread vj
I looked all over the web and can't seem to find any examples. Surely someone must be using python to access the paypal SDK. I found this link for ruby (which was helpful), but python code would be better: http://www.jeremyhubert.com/2006/7/7/using-paypal-website-payments-pro-with-ruby-on-rails

Re: Decimal() instead of float?

2006-11-17 Thread Michael B. Trausch
On Wed, 2006-11-15 at 12:48 +0100, Fredrik Lundh wrote: > Steve Holden wrote: > > >> It /would/ be nice to see Decimal() become the default. I cannot > >> imagine why in an otherwise "human enough" language, math wouldn't be > >> included in that without going out of one's way to do it. :-) >

Re: remove a list from a list

2006-11-17 Thread John Henry
The curve ball is the case insensitivity otherwise it's a straightforward set operation. I wonder if it's possible to sub-class set and make the item comparision case insensitive. Anybody knows how to do that? Tim Chase wrote: > > Yeah, I ended up doing a similar kind of loop. That is pretty m

Re: remove a list from a list

2006-11-17 Thread Rares Vernica
Sorry for not being clear from the beginning and for not using clear variable names. Problem context: import os dirs_exclude = set(('a', 'b', 'e')) for root, dirs, files in os.walk('python/Lib/email'): # Task: # delete from "dirs" the directory names from "dirs_exclude" # case-ins

Re: remove a list from a list

2006-11-17 Thread John Henry
Scratch that. b becomes all upper... John Henry wrote: > from sets import Set as set # Python 2.3 > > b = list( set([i.upper() for i in b) - set([i.upper() for i in a] ) ) > > > Rares Vernica wrote: > > Yeah, I ended up doing a similar kind of loop. That is pretty messy. > > > > Is there any ot

Re: remove a list from a list

2006-11-17 Thread Tim Chase
> from sets import Set as set # Python 2.3 > > b = list( set([i.upper() for i in b) - set([i.upper() for i in a] ) ) Just a caveat...this can change the order of items in the results as sets (and their differences) are inherently unordered data structures. If order of the items in the list n

Re: remove a list from a list

2006-11-17 Thread John Henry
from sets import Set as set # Python 2.3 b = list( set([i.upper() for i in b) - set([i.upper() for i in a] ) ) Rares Vernica wrote: > Yeah, I ended up doing a similar kind of loop. That is pretty messy. > > Is there any other way? > > Thanks, > Ray > > Tim Chase wrote: > >> That is a nice solu

Re: remove a list from a list

2006-11-17 Thread Tim Chase
> Yeah, I ended up doing a similar kind of loop. That is pretty messy. > > Is there any other way? I've already provided 2 (or 3 depending on how one counts) solutions, each of which solve an interpretation of your original problem, neither of which involve more than 3 lines of fairly clean co

Re: remove a list from a list

2006-11-17 Thread Fredrik Lundh
Fredrik Lundh wrote: >> What is a *nice* way of doing it? > > r = [i for i in e if i not in l] and swap l and e, add a few calls to lower, and start using better variable names in the future. -- http://mail.python.org/mailman/listinfo/python-list

Re: About alternatives to Matlab

2006-11-17 Thread Sébastien Boisgérault
On Nov 16, 10:46 pm, "John Henry" <[EMAIL PROTECTED]> wrote: > Bill Gates will have you jailed! :-) > > On a more serious note, is there any alternative to Simulink though? Ptolemy II. Java stuff in the core but components may be written in Python http://ptolemy.eecs.berkeley.edu/ptolemyII/ htt

Re: how to print pdf with python on a inkjet printer.

2006-11-17 Thread Fredrik Lundh
krishnakant Mane wrote: > I can't figure out where is the win32api module in my system. > I think I need to download it. > I tried to search but did not find it. googling for "python win32api" gives you: http://sourceforge.net/project/showfiles.php?group_id=78018 among the first few hits.

Re: remove a list from a list

2006-11-17 Thread Rares Vernica
Yeah, I ended up doing a similar kind of loop. That is pretty messy. Is there any other way? Thanks, Ray Tim Chase wrote: >> That is a nice solution. >> >> But, how about modifying the list in place? >> >> That is, l would become ['c', 'D']. >> >>> >>> e = ['a', 'b', 'e'] >>> >>> l = ['A', 'a'

Re: remove a list from a list

2006-11-17 Thread Fredrik Lundh
Rares Vernica wrote: > I have the following problem: > > I have a list like >e = ['a', 'b', 'e'] > and another list like >l = ['A', 'a', 'c', 'D', 'E'] > I would like to remove from l all the elements that appear in e > case-insensitive. That is, the result would be >r = ['c', 'D'] >

Re: remove a list from a list

2006-11-17 Thread Tim Chase
> That is a nice solution. > > But, how about modifying the list in place? > > That is, l would become ['c', 'D']. > >> >>> e = ['a', 'b', 'e'] >> >>> l = ['A', 'a', 'c', 'D', 'E'] >> >>> s = set(e) >> >>> [x for x in l if x.lower() not in s] >> ['c', 'D'] Well...changing the requirements m

Re: how to print pdf with python on a inkjet printer.

2006-11-17 Thread krishnakant Mane
On 17/11/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > http://tgolden.sc.sabren.com/python/win32_how_do_i/print.html > > or possibly: > > http://www.planetpdf.com/forumarchive/49365.asp I can't figure out where is the win32api module in my system. I think I need to download it. I tried

Re: About alternatives to Matlab

2006-11-17 Thread Filip Wasilewski
sturlamolden wrote: > Boris wrote: > > Hi, is there any alternative software for Matlab? Although Matlab is > > powerful & popular among mathematical & engineering guys, it still > > costs too much & not publicly open. So I wonder if there's similar > > software/lang that is open & with comparable

Re: Press button to load data

2006-11-17 Thread jim-on-linux
On Friday 17 November 2006 02:58, you wrote: > On Fri, 17 Nov 2006 00:25:39 -0500, > jim-on-linux <[EMAIL PROTECTED]> > > declaimed the following in comp.lang.python: > > Without being able to run the code my > > question is where is the id in the lambda > > defined? > > Please take into ac

Re: How fuzzy is get_close_matches() in difflib?

2006-11-17 Thread John Henry
Steven D'Aprano wrote: > > >>> s = difflib.SequenceMatcher(None, "HIDEDCT1", "HIDESCT1") > >>> t = difflib.SequenceMatcher(None, "HIDEDST1", "HIDESCT1") > >>> > >>> for block in s.get_matching_blocks(): > ... print "a[%d] and b[%d] match for %d elements" % block > ... > a[0] and b[0] match f

Re: remove a list from a list

2006-11-17 Thread Rares Vernica
That is a nice solution. But, how about modifying the list in place? That is, l would become ['c', 'D']. Thanks a lot, Ray Tim Chase wrote: >> I have a list like >>e = ['a', 'b', 'e'] >> and another list like >>l = ['A', 'a', 'c', 'D', 'E'] >> I would like to remove from l all the eleme

Re: What python modules are available?

2006-11-17 Thread Robert Kern
km wrote: > Hi all, > > Thats ridiculous! why is that the numpy implementation documentation is > put on sale and not available freely to everyone? http://www.tramy.us/FAQ.html In brief, because otherwise there wouldn't be any complete documentation. With all due respect to the Numeric manua

Re: Will GPL Java eat into Python marketshare?

2006-11-17 Thread Michael
>> Short answer: People use Python instead of Java because people (at >> least intelligent people) tend to avoid pain. >> > Intelligent people don't suffer from fanboy sentiments. They just pick a > language that works best for them. I agree with the previous poster and don't think it's just

Re: About alternatives to Matlab

2006-11-17 Thread Brian Blais
Matimus wrote: > Boris wrote: > > Hi, is there any alternative software for Matlab? Although Matlab is > > powerful & popular among mathematical & engineering guys, it still > > costs too much & not publicly open. So I wonder if there's similar > > software/lang that is open & with comparable

Re: What python modules are available?

2006-11-17 Thread km
Hi all, Thats ridiculous! why is that the numpy implementation documentation is put on sale and not available freely to everyone? regards, KM --- On 11/18/06, Robert Kern <[EMAIL PROTECTED]> wr

Re: How fuzzy is get_close_matches() in difflib?

2006-11-17 Thread John Henry
Learn something new everyday. I always wondered how spell checkers are done. Thanks. John Machin wrote: > John Henry wrote: > > I am just wondering what's with get_close_matches() in difflib. What's > > the magic? How fuzzy do I need to get in order to get a match? > > Are you desperate to un

Re: What python modules are available?

2006-11-17 Thread Robert Kern
Why Tea wrote: > All I need is something to provide me with array features. I can't > remember why I chose to use numarray a while ago... You will probably want numpy these days. numarray is being phased out. http://numpy.scipy.org/ -- Robert Kern "I have come to believe that the whole world

Re: How fuzzy is get_close_matches() in difflib?

2006-11-17 Thread John Henry
I suppose you are right. I guess I ended up with an odd case. I was thinking that: To change "HIDE*S*ST1" to "HIDE*D*ST1", all you do is remove the "*S*" from the source and the "*D*" from the target. In order to change "HIDE*SC*T1" to "HIDE*DS*T1", I thought you have to remove 2 characters *SC

Re: numpy magic: cast scalar returns auto to python types float & int ?

2006-11-17 Thread Robert Kern
robert wrote: > Didn't find the relevant reasoning within time. Yet guess the reason is > isolated-module-centric. I gave you a brief rundown on this list already. http://mail.python.org/pipermail/python-list/2006-October/411145.html And I'll note again that a fuller discussion is given in

Re: Python v PHP for web, and restarting Apache?

2006-11-17 Thread Michael Ströder
walterbyrd wrote: > I think I have read somewhere that using Python to develop > web-applications requires some restarting of the Apache server, whereas > PHP does not. Using Python to develop web-applications is a very broad topic. E.g. you don't have to restart Apache if you develop simple shor

Re: remove a list from a list

2006-11-17 Thread Tim Chase
> I have a list like >e = ['a', 'b', 'e'] > and another list like >l = ['A', 'a', 'c', 'D', 'E'] > I would like to remove from l all the elements that appear in e > case-insensitive. That is, the result would be >r = ['c', 'D'] > > What is a *nice* way of doing it? Well, it's usuall

Re: Python v PHP for web, and restarting Apache?

2006-11-17 Thread gabor
walterbyrd wrote: > I think I have read somewhere that using Python to develop > web-applications requires some restarting of the Apache server, whereas > PHP does not. > first thing... there are many many ways how to run a python-apache web application.. - mod_python - cgi - fastcgi - sci - pr

remove a list from a list

2006-11-17 Thread Rares Vernica
Hi, I have the following problem: I have a list like e = ['a', 'b', 'e'] and another list like l = ['A', 'a', 'c', 'D', 'E'] I would like to remove from l all the elements that appear in e case-insensitive. That is, the result would be r = ['c', 'D'] What is a *nice* way of doing it?

Re: Heap Memory

2006-11-17 Thread Fredrik Lundh
Gregory Piñero wrote: > How does Python use memory on a 64 bit OS? Is there a lot more > available to it by default? as we've already said a couple of hundred times in this thread, Python uses *all* the memory it can get from the operating system. no more, no less. (the link I posted yesterd

Slicing / subsetting list in arbitrary fashion

2006-11-17 Thread Gregg Lind
I wish something like this was part of the standard python installation, and didn't require one to use Numpy or Numarray. This sort of list subsetting is useful in many, many contexts. -- http://mail.python.org/mailman/listinfo/python-list

Re: determining the bounds of a tuple returned from a database

2006-11-17 Thread [EMAIL PROTECTED]
ronrsr wrote: > very sorry, that was my error - len(result[0]) and len(result[1]) both > return 1 -- > > i think I'm misunderstanding what len() does - to me they appear to > have 2 or 3 elements, or at least be composed of a string of some > length. One string composed of multiple data elements

Re: Slicing / subsetting list in arbitrary fashion

2006-11-17 Thread Fredrik Lundh
Gregg Lind wrote: > One difficulty I am having with using Python for scientific computing is > that I cannot figure out good ways to get arbitrary (unpatterned?) slices. > In Python, solutions I have found for these tasks are: > > [vals[ii] for ii in wanted]# task 1 > > [a[1] for in zip

Slicing / subsetting list in arbitrary fashion

2006-11-17 Thread Gregg Lind
One difficulty I am having with using Python for scientific computing is that I cannot figure out good ways to get arbitrary (unpatterned?) slices. As an example, in R or Matlab / Octave, syntax exists such that: vals = range(6) wanted = [1,2,3,1,1,1] vals[wanted] = [1,2,3,1,1,1] Both of those

Re: Python v PHP for web, and restarting Apache?

2006-11-17 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, walterbyrd wrote: > I am not trying to suggest anything here. I'm just asking. Asking what? Asking something usually involves a question. ;-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Python v PHP for web, and restarting Apache?

2006-11-17 Thread walterbyrd
I think I have read somewhere that using Python to develop web-applications requires some restarting of the Apache server, whereas PHP does not. Also, I seem to remember reading something about PHP being able to recover from Apache restarting more easily than Python. I am not trying to suggest a

Re: Heap Memory

2006-11-17 Thread Gregory Piñero
On 11/17/06, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > The default configuration for WinXP is 2GB shared OS, and 2GB > process... I believe there is some registry setting that can change that > to 1GB/3GB. I did some research and it looks like it does apply to XP (http://support.micro

Re: pyserial port connection problem

2006-11-17 Thread Nick Craig-Wood
Jon <[EMAIL PROTECTED]> wrote: > I wrote some code to read in info from a port using pyserial. the code > reads info sent by a box that is connected to my computer by an > rs232-to usb adapter. When I was writing the code and testing it on my > computer it worked fine. > I ran py2exe on the pr

Re: String Replace only if whole word?

2006-11-17 Thread Tim Chase
> I have been using the string.replace(from_string, to_string, len(string)) > to replace names in a file with their IP address. > For example, I have definitions file, that looks something like: > 10.1.3.4 LANDING_GEAR > 20.11.222.4 ALTIMETER_100 > 172.18.50.138 SIB > 172.18.50.138 LAPTOP >

  1   2   >