Re: How to escape # hash character in regex match strings

2009-06-11 Thread Lie Ryan
504cr...@gmail.com wrote: > I've encountered a problem with my RegEx learning curve -- how to > escape hash characters # in strings being matched, e.g.: > string = re.escape('123#abc456') match = re.match('\d+', string) print match > > <_sre.SRE_Match object at 0x00A6A800> pri

Re: How should I compare two txt files separately coming from windows/dos and linux/unix

2009-06-11 Thread higer
On Jun 11, 1:08 pm, John Machin wrote: > Chris Rebert rebertia.com> writes: > > > > > > > On Wed, Jun 10, 2009 at 8:11 PM, higer gmail.com> wrote: > > > I just want to compare two files,one from windows and the other from > > > unix. But I do not want to compare them through reading them line by

Re: How should I compare two txt files separately coming from windows/dos and linux/unix

2009-06-11 Thread higer
On Jun 11, 11:44 am, Chris Rebert wrote: > On Wed, Jun 10, 2009 at 8:11 PM, higer wrote: > > I just want to compare two files,one from windows and the other from > > unix. But I do not want to compare them through reading them line by > > line. Then I found there is a filecmp module which is used

Re: object reincarnation

2009-06-11 Thread alex23
On Jun 11, 5:34 am, Manavan wrote: > Since the real world objects often needs to be deleted even if they > have some reference from some other object [...] >From this it sounds like you're trying to implement some form of weak referencing. Are you familiar with weakref? "A weak reference to an o

zipfile doesn't compress very good, are there other solutions ?

2009-06-11 Thread Stef Mientki
hello, I want to make a distro for Ubuntu, and run under Windows. I packed all sources with zipfile, but the compression doesn't seem to be very good. If run the created file through 7zip, it becomes anout half the size. Is there a way to accomplish the same task with zipfile ( the documentat

Re: multi-core software

2009-06-11 Thread Jon Harrop
Matthias Blume wrote: > "Jeff M." writes: >> But, assuming that your program works and does what it's supposed to, >> I agree with Jon that performance needs to be right near the top of >> the list of concerns. Why? Performance isn't about looking good as a >> programmer, or having fun making a fu

xml.dom.minidom losing the XML document type attribute

2009-06-11 Thread Johannes Bauer
Hello group, when I read in a XML document with the xml.dom.minidom parser and write it out again, an attribute is lost: Input: [...] Output: How can I fix this? Python is Python 3.0rc2 (r30rc2:67114, Nov 16 2008, 15:24:36) Kind regards, Johannes -- "Meine Gegenklage gegen dich lautet dan

Re: can it be shorter?

2009-06-11 Thread Carlos Valiente
Paul Rubin writes: > url = url.rstrip('/') + '/' That's what I use: It has the (nice) side effect of ending the URL with a *single* slash. C -- http://mail.python.org/mailman/listinfo/python-list

Re: zipfile doesn't compress very good, are there other solutions ?

2009-06-11 Thread Chris Rebert
On Tue, Jun 9, 2009 at 3:07 PM, Stef Mientki wrote: > hello, > > I want to make a distro for Ubuntu, > and run under Windows. > > I packed all sources with zipfile, > but the compression doesn't seem to be very good. > > If run the created file through 7zip, it becomes anout half the size. Are you

Re: object reincarnation

2009-06-11 Thread Carl Banks
On Jun 10, 12:34 pm, Manavan wrote: > Hello everyone, >    Since the real world objects often needs to be deleted even if they > have some reference from some other object, I am going to use this > approach to better model this situation, by cleaning up the attributes > and assigning self.__class_

Re: installation in mac os x

2009-06-11 Thread Diez B. Roggisch
Karl Jansson wrote: > Hi, > > I was doing the tutorial at http://www.python.org/doc/current/ > tutorial/, and I came across some code that did not work, and I got > the following error: AttributeError: 'str' object has no attribute > 'format'. > > So I downloaded a .dmg of python 2.6.2

ANN: eGenix pyOpenSSL Distribution 0.9.0-0.9.8k

2009-06-11 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com pyOpenSSL Distribution Version 0.9.0-0.9.8k An easy to install and use repackaged distribution of the pyOpenSSL Python interfa

Re: unladen swallow: python and llvm

2009-06-11 Thread Stefan Behnel
Nick Craig-Wood wrote: > Luis M González wrote: >> I am very excited by this project (as well as by pypy) and I read all >> their plan, which looks quite practical and impressive. >> But I must confess that I can't understand why LLVM is so great for >> python and why it will make a difference

Convert integer to fixed length binary string

2009-06-11 Thread casebash
Hi, I know the bin function converts an int into a binary string. Unfortunately, I need to know the length of the binary string when it is being read in and len(bin(x)) depends on x. Is there any way to limit it to 4 bytes? Thanks for your assistance, Chris -- http://mail.python.org/mailman/lis

Re: unladen swallow: python and llvm

2009-06-11 Thread Stefan Behnel
bearophileh...@lycos.com wrote: > Kay Schluehr: >> Don't understand your Cython compliant. The only tricky part of Cython >> is the doublethink regarding Python types and C types. I attempted once >> to write a ShedSkin like code transformer from Python to Cython based on >> type recordings but nev

Re: Convert integer to fixed length binary string

2009-06-11 Thread Mark Dickinson
On Jun 11, 10:29 am, casebash wrote: > Sorry, I didn't quite make it clear. The issue isn't about limiting > the length (as I won't be using integers bigger than this). The > problem is that sometimes the output is shorter. Is this what you're looking for? Python 2.6.2 (r262:71600, Jun 8 2009,

Re: xml.dom.minidom losing the XML document type attribute

2009-06-11 Thread Johannes Bauer
Stefan Behnel schrieb: > Johannes Bauer wrote: >> when I read in a XML document with the xml.dom.minidom parser and write >> it out again, an attribute is lost: >> >> Input: >> >> >> [...] >> >> Output: >> >> >> How can I fix this? > > You don't have to. UTF-8 is the default encoding, so the two

Re: xml.dom.minidom losing the XML document type attribute

2009-06-11 Thread Stefan Behnel
Johannes Bauer wrote: > Stefan Behnel schrieb: >> Johannes Bauer wrote: >>> when I read in a XML document with the xml.dom.minidom parser and write >>> it out again, an attribute is lost: >>> >>> Input: >>> >>> >>> [...] >>> >>> Output: >>> >>> >>> How can I fix this? >> You don't have to. UTF-8

Re: Compiling Python3.1

2009-06-11 Thread Jeremiah Dodds
On Wed, Jun 10, 2009 at 10:33 PM, Johannes Bauer wrote: > Martin v. Löwis schrieb: > >> What can I do about that? > > > > Remove the non-ASCII characters from db.h. > > Ehh... > > $ find -type f | grep -i db.h > OT: find -type f -iname "db.h" -- http://mail.python.org/mailman/listinfo/python-li

Re: random number including 1 - i.e. [0,1]

2009-06-11 Thread Esmail
Thanks everyone, I learned more than I expected about floats :-) and got some good explanations and ideas about all of this. Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert integer to fixed length binary string

2009-06-11 Thread Ulrich Eckhardt
casebash wrote: > I know the bin function converts an int into a binary string. Binary string sounds ambiguous. Firstly, everything is binary. Secondly, strings are byte strings or Unicode strings. In any case, I'm not 100% sure what you mean - giving an example of input and output would help! >

Re: zipfile doesn't compress very good, are there other solutions ?

2009-06-11 Thread Peter Otten
Stef Mientki wrote: > I packed all sources with zipfile, > but the compression doesn't seem to be very good. If you don't specify the compression, the files are not compressed at all. Just in case you didn't know... Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert integer to fixed length binary string

2009-06-11 Thread casebash
Sorry, I didn't quite make it clear. The issue isn't about limiting the length (as I won't be using integers bigger than this). The problem is that sometimes the output is shorter. -- http://mail.python.org/mailman/listinfo/python-list

OT: Periodic table gets a new element

2009-06-11 Thread MRAB
Element 112 is to be named. Do you think we could persuade the scientists to name it "Pythonium"? :-) http://news.bbc.co.uk/1/hi/sci/tech/8093374.stm -- http://mail.python.org/mailman/listinfo/python-list

Re: retrieve bitwise float representation

2009-06-11 Thread Tom K.
On Jun 10, 8:41 am, Ulrich Eckhardt wrote: > I need to pack a floating point value into a vector of 32-bit unsigned > values in IEEE format. Further, I maintain a CRC32 checksum for integrity > checking. For the latter, I actually need the float as integral value. ... > What I'm wondering is wheth

Re: xml.dom.minidom losing the XML document type attribute

2009-06-11 Thread Johannes Bauer
Stefan Behnel schrieb: >> Can I somehow force Python to generate it anyways? > > Did you try passing encoding='UTF-8' on serialisation? Uhm... nope - how can I do that? > >> I have software which >> complains if an explicit encoding is missing... > > Well, to parse XML, it's best to use an XM

Re: OT: Periodic table gets a new element

2009-06-11 Thread Jean-Michel Pichavant
Not if this element is to end up in some further ultimate nuclear weapon :-) , unless you are using python to conquer the world (I've been told this is GVR main secret objective). MRAB wrote: Element 112 is to be named. Do you think we could persuade the scientists to name it "Pythonium"? :-

Re: xml.dom.minidom losing the XML document type attribute

2009-06-11 Thread Stefan Behnel
Johannes Bauer wrote: > Stefan Behnel schrieb: > >>> Can I somehow force Python to generate it anyways? >> Did you try passing encoding='UTF-8' on serialisation? > > Uhm... nope - how can I do that? Well, depends on what your code currently does. Maybe you could use something like doc.

Re: OT: Periodic table gets a new element

2009-06-11 Thread Michiel Overtoom
MRAB wrote: Element 112 is to be named. Do you think we could persuade the scientists to name it "Pythonium"? :-) What did Python do to deserve this? I think 'Hofmannium' is a more appropriate name ;-) On the other hand, if the scientists used Python on their equipment with which they dis

Re: Programming language comparison examples?

2009-06-11 Thread Ben Rousch
pobox.com> writes: > > I thought there was a website which demonstrated how to program a bunch of > small problems in a number of different languages. I know about the > Programming Language Shootout: > > http://shootout.alioth.debian.org/ > > but that's not what I was thinking of. I tho

FW: [Tutor] Multi-Threading and KeyboardInterrupt

2009-06-11 Thread Strax-Haber, Matthew (LARC-D320)
I sent this to the Tutor mailing list and did not receive a response. Perhaps one of you might be able to offer some sagely wisdom or pointed remarks? Please reply off-list and thanks in advance. Code examples are below in plain text. -- Forwarded Message > From: Matthew Strax-Haber > Reply-

Re: How to escape # hash character in regex match strings

2009-06-11 Thread Brian D
On Jun 11, 2:01 am, Lie Ryan wrote: > 504cr...@gmail.com wrote: > > I've encountered a problem with my RegEx learning curve -- how to > > escape hash characters # in strings being matched, e.g.: > > string = re.escape('123#abc456') > match = re.match('\d+', string) > print match > >

Re: How to escape # hash character in regex match strings

2009-06-11 Thread Brian D
On Jun 11, 9:22 am, Brian D wrote: > On Jun 11, 2:01 am, Lie Ryan wrote: > > > > > 504cr...@gmail.com wrote: > > > I've encountered a problem with my RegEx learning curve -- how to > > > escape hash characters # in strings being matched, e.g.: > > > string = re.escape('123#abc456') > >

Re: How to escape # hash character in regex match strings

2009-06-11 Thread 504cr...@gmail.com
On Jun 11, 2:01 am, Lie Ryan wrote: > 504cr...@gmail.com wrote: > > I've encountered a problem with my RegEx learning curve -- how to > > escape hash characters # in strings being matched, e.g.: > > string = re.escape('123#abc456') > match = re.match('\d+', string) > print match > >

Re: spawning a process using os.spawn

2009-06-11 Thread Gabriel Genellina
En Tue, 09 Jun 2009 15:38:53 -0300, rkmr...@gmail.com escribió: im spawning a script that runs for a long from a web app like this: os.spawnle(os.P_NOWAIT, "../bin/producenotify.py", "producenotify.py", "xx",os.environ) the script is spawned and it runs, but till it gets over i am not able t

Re: preferring [] or () in list of error codes?

2009-06-11 Thread Gabriel Genellina
En Tue, 09 Jun 2009 05:02:33 -0300, Steven D'Aprano escribió: [...] As tuples are defined in Python, they quack like immutable lists, they walk like immutable lists, and they swim like immutable lists. Why shouldn't we treat them as immutable lists? Phillip Eby states that "Lists are intende

install older Python version parallel

2009-06-11 Thread S. Dornseifer
Hi everybody, The situation: I wrote a GUI, based on Python, TkInter and Pmw. It runs perfectly fine with Python 2.4 (providing, TkInter and Pmw are installed). But it crashes with Python 2.6. I tried this on MacOSX11.4 and various Linux Distributions. Crashes occurs when I activate a Pmw.Diaog

Re: .pth files and figuring out valid paths..

2009-06-11 Thread Gabriel Genellina
En Tue, 09 Jun 2009 20:30:06 -0300, rh0dium escribió: On Jun 9, 3:28 pm, Emile van Sebille wrote: On 6/9/2009 3:00 PM rh0dium said... > I have a .pth file which has some logic in it - but it isn't quite > enough... > It started with this.. > import os, site; site.addsitedir(os.path.join(os.e

Re: How to insert string in each match using RegEx iterator

2009-06-11 Thread 504cr...@gmail.com
On Jun 10, 10:13 am, Peter Otten <__pete...@web.de> wrote: > 504cr...@gmail.com wrote: > > I wonder if you (or anyone else) might attempt a different explanation > > for the use of the special sequence '\1' in the RegEx syntax. > > > The Python documentation explains: > > > \number > >     Matches

Re: preferring [] or () in list of error codes?

2009-06-11 Thread Gunter Henriksen
> [In this tuple] >dodge_city = (1781, 1870, 1823) >(population, feet_above_sea_level, establishment_year) = dodge_city > each index in the sequence implies something very > different about each value. The semantic meaning > of each index is *more* than just the position in > the sequence;

Re: install older Python version parallel

2009-06-11 Thread A. Cavallo
Hi, I'm working on a project of mine that does creates python installation under /opt so they can be installed side by side with a system installed one. There's a web page: http://pyvm.sourceforge.net/ With links to the newest build plus all teh accompaining unitests. But you can use the sour

Re: xml.dom.minidom losing the XML document type attribute

2009-06-11 Thread David Robinow
On Thu, Jun 11, 2009 at 9:20 AM, Johannes Bauer wrote: > Well, I'm not speaking about my software :-) Actually it's Gnucash which > complains if the tag is not explicitly set. This is because they > appearently had a ancient version which did not specify the charset, but > used a different one than

Changing Hash Values Across Versions

2009-06-11 Thread Phil Thompson
How stable should the implementation of, for example, a string's hash across different Python versions? Is it defined that hash("foo") will return the same value for Python 2.5.1, 2.6.1 and 2.6.2? Thanks, Phil -- http://mail.python.org/mailman/listinfo/python-list

Issues download 2.4 python (for windows) msi

2009-06-11 Thread Praveen Kariyanahalli
Hi I am having issues downloading any msi prior to the 3.X version. All of them appear to be truncated. My old scripts dont compile on the later versions. Can someone please fix this ASAP ? Thanks -Praveen -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert integer to fixed length binary string

2009-06-11 Thread Mensanator
On Jun 11, 4:29 am, casebash wrote: > Sorry, I didn't quite make it clear. The issue isn't about limiting > the length (as I won't be using integers bigger than this). The > problem is that sometimes the output is shorter. This works also: >>> bin(15)[2:].zfill(32) '1

Re: Changing Hash Values Across Versions

2009-06-11 Thread Scott David Daniels
Phil Thompson wrote: How stable should the implementation of, for example, a string's hash across different Python versions? Is it defined that hash("foo") will return the same value for Python 2.5.1, 2.6.1 and 2.6.2? Thanks, Phil Pretty certain that A.B.* will always hash the same (unacceptab

Re: Changing Hash Values Across Versions

2009-06-11 Thread Gabriel Genellina
En Thu, 11 Jun 2009 13:56:17 -0300, Phil Thompson escribió: How stable should the implementation of, for example, a string's hash across different Python versions? I cannot find any such guarantee in the documentation: http://docs.python.org/reference/datamodel.html Is it defined that hash

Re: itertools.intersect?

2009-06-11 Thread Terry Reedy
Jack Diederich wrote: On Thu, Jun 11, 2009 at 12:03 AM, David M. Wilson wrote: [snip] I found my answer: Python 2.6 introduces heap.merge(), which is designed exactly for this. Thanks, I knew Raymond added something like that but I couldn't find it in itertools. That said .. it doesn't help.

Alter list items within loop

2009-06-11 Thread Brendan
Can someone please explain what is happening in the output below? The number 3 never gets printed. Does Python make a copy of a list before it iterates through it?: >>> e = range(1,5) >>> for i in e: print i if i == 2 : e.remove(i) 1 2 4 >>> e [1, 3, 4] -- http://

Re: Restart the interactive python shell like in IDLE

2009-06-11 Thread Terry Reedy
Chris Rebert wrote: On Wed, Jun 10, 2009 at 12:01 PM, Matt Burson wrote: Is there a way to reproduce the behavior of IDLE's restart shell ability by using a function? I thought there would be since you can exit python by executing the simple quit() function I thought there would be an equally si

Re: zipfile doesn't compress very good, are there other solutions ?

2009-06-11 Thread Stef Mientki
Peter Otten wrote: Stef Mientki wrote: I packed all sources with zipfile, but the compression doesn't seem to be very good. If you don't specify the compression, the files are not compressed at all. Just in case you didn't know... .. and would you be willing to tell me how I could

Re: Alter list items within loop

2009-06-11 Thread Emile van Sebille
On 6/11/2009 11:54 AM Brendan said... Can someone please explain what is happening in the output below? you delete e[2] before displaying it. The number 3 never gets printed. Does Python make a copy of a list before it iterates through it?: No. Mods to a list while passing it is generally

Re: zipfile doesn't compress very good, are there other solutions ?

2009-06-11 Thread Chris Rebert
On Thu, Jun 11, 2009 at 12:11 PM, Stef Mientki wrote: > Peter Otten wrote: >> Stef Mientki wrote: >>> I packed all sources with zipfile, >>> but the compression doesn't seem to be very good. >>> >> >> If you don't specify the compression, the files are not compressed at all. >> Just in case you did

Re: Alter list items within loop

2009-06-11 Thread Tim Harig
On 2009-06-11, Brendan wrote: > Can someone please explain what is happening in the output below? The > number 3 never gets printed. Does Python make a copy of a list before > it iterates through it?: You can see what is happening by printing the list as you work through the loop: >>> e = range(

Re: zipfile doesn't compress very good, are there other solutions?

2009-06-11 Thread Peter Otten
Stef Mientki wrote: > Peter Otten wrote: >> Stef Mientki wrote: >> >> >>> I packed all sources with zipfile, >>> but the compression doesn't seem to be very good. >>> >> >> If you don't specify the compression, the files are not compressed at >> all. Just in case you didn't know... >> >

Blogger Widget web app

2009-06-11 Thread steven.oldner
Please give me directions on where to start researching for answers. I probably can do the javascript, but I don't know where to start on the Python. 1. Wife has a blogger blog and wants a widget to embed in the posts. 2. Widget will have a form that readers can enter their name and url. 3. Widget

Re: Changing Hash Values Across Versions

2009-06-11 Thread Christian Heimes
Phil Thompson schrieb: > How stable should the implementation of, for example, a string's hash > across different Python versions? > > Is it defined that hash("foo") will return the same value for Python 2.5.1, > 2.6.1 and 2.6.2? The hash of an object is an internal implementation detail. The has

EXTENDED: OSCON 2009 early bird (June 23)

2009-06-11 Thread Aahz
Registration is now open for the O'Reilly Open Source Convention (OSCON). OSCON 2009 will be July 20-24 in San Jose, California. Early registration has been extended and now ends June 23. Use the special discount code 'os09pgm' for an extra 15% off. For more information: http://conferences.oreil

Unhandled exception in thread

2009-06-11 Thread Mads Michelsen
(I'll ask you to bear with the somewhat vague description in advance - I'm a noob in all respects here, with regard to python and the mailing list) I'm getting some error reports sometimes when I quit a script, I've been working on. The reports are extremely uninformative, and I do not notice anyt

Voronoi diagram algorithm (Fortune’s sweepline)

2009-06-11 Thread Captain___nemo
Hi, I am implementing Voronoi diagram to find out the nearest location in a map visually. Right now I want to do this using integer coordinates (x,y) only in a canvas. Problem is- I am really confused about this algorithm. I read the Computational Geometry book, few more theory on Fortune's algori

Re: itertools.intersect?

2009-06-11 Thread Arnaud Delobelle
David Wilson writes: > Hi, > > During a fun coding session yesterday, I came across a problem that I > thought was already solved by itertools, but on investigation it seems > it isn't. > > The problem is simple: given one or more ordered sequences, return > only the objects that appear in each s

Re: Changing Hash Values Across Versions

2009-06-11 Thread Mark Dickinson
On Jun 11, 8:55 pm, Christian Heimes wrote: > Phil Thompson schrieb: > > > How stable should the implementation of, for example, a string's hash > > across different Python versions? > > > Is it defined that hash("foo") will return the same value for Python 2.5.1, > > 2.6.1 and 2.6.2? > > The hash

reading from file

2009-06-11 Thread Sydoruk Yaroslav
Hello all, In a text file aword.txt, there is a string: "\xea\xe0\xea+\xef\xee\xe7\xe2\xee\xed\xe8\xf2\xfc". There is a first script: f = open ("aword.txt", "r") for line in f: print chardet.detect(line) b = line.decode('cp1251') print b _RESULT_ {'confidence': 1.0, 'encoding': '

Re: Voronoi diagram algorithm (Fortune’s sweepline )

2009-06-11 Thread Bearophile
Captain___nemo: > Isn't it possible to implement Voronoi diagram using Fortune's > algorithm without multithreading or hash map? Multi-threading isn't part of Fortune's algorithm. Multi-threading can be confusing, but it's better for you to learn to feel at home using hash maps (named dicts in Pyt

Re: zipfile doesn't compress very good, are there other solutions?

2009-06-11 Thread Stef Mientki
Peter Otten wrote: Stef Mientki wrote: Peter Otten wrote: Stef Mientki wrote: I packed all sources with zipfile, but the compression doesn't seem to be very good. If you don't specify the compression, the files are not compressed at all. Just in case you didn

Re: reading from file

2009-06-11 Thread Jeff McNeil
On Jun 11, 4:24 pm, Sydoruk Yaroslav wrote: > Hello all, > > In a text file aword.txt, there is a string: >     "\xea\xe0\xea+\xef\xee\xe7\xe2\xee\xed\xe8\xf2\xfc". > > There is a first script: > f = open ("aword.txt", "r") > for line in f: >     print chardet.detect(line) >     b = line.decode('c

Re: Alter list items within loop

2009-06-11 Thread Duncan Booth
Tim Harig wrote: >> number 3 never gets printed. Does Python make a copy of a list before >> it iterates through it?: > > No, complex types are passed by reference unless explicity copied. *All* types are passed by reference unless explicitly copied. Python does make special cases for simple

Re: zipfile doesn't compress very good, are there other solutions?

2009-06-11 Thread Chris Rebert
On Thu, Jun 11, 2009 at 1:41 PM, Stef Mientki wrote: > Peter Otten wrote: >> Stef Mientki wrote: >>> Peter Otten wrote: Stef Mientki wrote: > I packed all sources with zipfile, > but the compression doesn't seem to be very good. > If you don't specify the compression, the

Re: Voronoi diagram algorithm (Fortune’s sweep line)

2009-06-11 Thread Robert Kern
On 2009-06-11 14:56, Captain___nemo wrote: Hi, I am implementing Voronoi diagram to find out the nearest location in a map visually. Right now I want to do this using integer coordinates (x,y) only in a canvas. Problem is- I am really confused about this algorithm. I read the Computational Geome

ANN: WHIFF += Flash chart widget support

2009-06-11 Thread Aaron Watters
WHIFF.0.3 adds amChart Flash based Charts. The amChart chart widgets [ http://www.amcharts.com ] provide a sophisticated methodology for creating beautiful and interactive statistical charts using Adobe Flash plug-in technology. The WHIFF.0.3 release adds extensive support for embedding amChart

Re: reading from file

2009-06-11 Thread Sydoruk Yaroslav
Jeff McNeil wrote: > Is the string in your text file literally "\xea\xe0\xea+\xef\xee > \xe7\xe2\xee\xed\xe8\xf2\xfc" as "plain text?" My assumption is that > when you're reading that in, Python is interpreting each byte as an > ASCII value (and rightfully so) rather than the corresponding '\x' >

Re: Alter list items within loop

2009-06-11 Thread Tim Harig
On 2009-06-11, Duncan Booth wrote: > Tim Harig wrote: >>> number 3 never gets printed. Does Python make a copy of a list before >>> it iterates through it?: >> No, complex types are passed by reference unless explicity copied. > *All* types are passed by reference unless explicitly copied. Pytho

Re: Voronoi diagram algorithm (Fortune’s sweepline )

2009-06-11 Thread Bearophile
Robert Kern: > You can see a mild modification of Fortune's original C code here: > > http://svn.scipy.org/svn/scikits/trunk/delaunay/scikits/delaunay/Voro... That's C++; C++ makes simple things hard and hard things possible :-) In Python that code may become much shorter (and slower). Bye, bearo

Re: itertools.intersect?

2009-06-11 Thread Jack Diederich
On Thu, Jun 11, 2009 at 2:54 PM, Terry Reedy wrote: > Jack Diederich wrote: >> >> On Thu, Jun 11, 2009 at 12:03 AM, David M. Wilson wrote: >> [snip] >>> >>> I found my answer: Python 2.6 introduces heap.merge(), which is >>> designed exactly for this. >> >> Thanks, I knew Raymond added something li

Re: Unhandled exception in thread

2009-06-11 Thread Scott David Daniels
Mads Michelsen wrote: ...I'm getting some error reports ... looking for advice on a way that I can investigate the error The script ... downloads and... > in the background using a separate thread (the 'thread' module), > Sometimes, when I quit the script, the following error messa

Re: unladen swallow: python and llvm

2009-06-11 Thread Nick Craig-Wood
Stefan Behnel wrote: > Nick Craig-Wood wrote: > > Luis M González wrote: > >> I am very excited by this project (as well as by pypy) and I read all > >> their plan, which looks quite practical and impressive. > >> But I must confess that I can't understand why LLVM is so great for > >> pytho

help with errror

2009-06-11 Thread tanner barnes
could some one explain this error to me and possibly how to fix it? Traceback (most recent call last): File "C:\Users\brandon\workspace\tanner's workshop\tanner's workshop\src\WxGlade.py", line 458, in Edit = MyDialog2(None, -1, "") File "C:\Users\brandon\workspace\tanner's workshop\tan

Re: Voronoi diagram algorithm (Fortune’s sweep line)

2009-06-11 Thread Robert Kern
On 2009-06-11 16:16, Bearophile wrote: Robert Kern: You can see a mild modification of Fortune's original C code here: http://svn.scipy.org/svn/scikits/trunk/delaunay/scikits/delaunay/Voro... That's C++; C++ makes simple things hard and hard things possible :-) The actual algorithm implemen

what does "lost sys.stdin" error mean?

2009-06-11 Thread lynvie
I have a very simple program from the first chapter of a book on python 3 (I'm a novice). I called the program tmp.py and the data input file is sum.dat (just a list of numbers, 1 per line). When I type into my command shell "tmp.py < sum.dat" I get an error from "line=input()" -- that's line 7 fro

Re: preferring [] or () in list of error codes?

2009-06-11 Thread Ben Finney
Gunter Henriksen writes: > I think I would have difficulty holding a position that this should > not be a class (or equivalent via namedtuple()) or a dict. It seems to > me like a case could be made that there are far more situations where > it makes sense to use tuples as immutable sequences tha

Re: Voronoi diagram algorithm (Fortune’s sweepline )

2009-06-11 Thread dorzey
Found this python implementation: http://www.oxfish.com/python/voronoi.py >From what I understand, not my area of expertise, it would seem to be correct. -- http://mail.python.org/mailman/listinfo/python-list

Re: Voronoi diagram algorithm (Fortune’s sweepline )

2009-06-11 Thread dorzey
Found this python implementation: http://www.oxfish.com/python/voronoi.py >From what I understand, not my area of expertise, it would seem to be correct. -- http://mail.python.org/mailman/listinfo/python-list

Re: Voronoi diagram algorithm (Fortune’s sweepline )

2009-06-11 Thread dorzey
Found this python implementation: http://www.oxfish.com/python/voronoi.py >From what I understand, not my area of expertise, it would seem to be correct. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to escape # hash character in regex match strings

2009-06-11 Thread Rhodri James
On Thu, 11 Jun 2009 15:22:44 +0100, Brian D wrote: I'm surprised it's been so difficult to find an example of the hash character in a RegEx string -- for exactly this type of situation, since it's so common in the real world that people want to put a pound symbol in front of a number. It's a

Re: install older Python version parallel

2009-06-11 Thread Rhodri James
On Thu, 11 Jun 2009 15:50:06 +0100, S. Dornseifer wrote: Hi everybody, The situation: I wrote a GUI, based on Python, TkInter and Pmw. It runs perfectly fine with Python 2.4 (providing, TkInter and Pmw are installed). But it crashes with Python 2.6. I tried this on MacOSX11.4 and various

Re: How to escape # hash character in regex match strings

2009-06-11 Thread Tim Chase
I'm surprised it's been so difficult to find an example of the hash character in a RegEx string -- for exactly this type of situation, since it's so common in the real world that people want to put a pound symbol in front of a number. It's a character with no special meaning to the regex engine,

command line of a process.exe on another host

2009-06-11 Thread Harry
HI , I have number of process run on different windows servers which run's with different command line parameters. for example "process.exe -input statusurl: http://sss.com "., These parameters can vary from host to host. using Psexec I know the PID and process name which are running on these

Re: xml.dom.minidom losing the XML document type attribute

2009-06-11 Thread Johannes Bauer
Stefan Behnel schrieb: > Johannes Bauer wrote: >> Stefan Behnel schrieb: >> Can I somehow force Python to generate it anyways? >>> Did you try passing encoding='UTF-8' on serialisation? >> Uhm... nope - how can I do that? > > Well, depends on what your code currently does. > > Maybe you coul

Re: xml.dom.minidom losing the XML document type attribute

2009-06-11 Thread Johannes Bauer
David Robinow schrieb: > On Thu, Jun 11, 2009 at 9:20 AM, Johannes Bauer wrote: >> Well, I'm not speaking about my software :-) Actually it's Gnucash which >> complains if the tag is not explicitly set. This is because they >> appearently had a ancient version which did not specify the charset, but

Re: itertools.intersect?

2009-06-11 Thread Mensanator
On Jun 11, 1:54 pm, Terry Reedy wrote: > Jack Diederich wrote: > > On Thu, Jun 11, 2009 at 12:03 AM, David M. Wilson wrote: > > [snip] > >> I found my answer: Python 2.6 introduces heap.merge(), which is > >> designed exactly for this. > > > Thanks, I knew Raymond added something like that but I c

Re: Voronoi diagram algorithm (Fortune’s sweepline )

2009-06-11 Thread Carl Banks
On Jun 11, 2:01 pm, Robert Kern wrote: > On 2009-06-11 14:56, Captain___nemo wrote: > > Please advice me very simple implementation of voronoi diagram (given > > coordinates). Please advice me simple python code preferably without- > > hash, multi-threading, Delaunay Traingulation, > > You can't r

Re: How *build* new elements and *replace* elements with xml.dom.minidom ?

2009-06-11 Thread Johannes Bauer
Stefan Behnel schrieb: >> So I need to build hyperlinks (a elements) with href attribute and >> replace the text elements (numbers) somehow. > > Try lxml.html instead. It makes it really easy to do these things. For > example, you can use XPath to find all table cells that contain numbers: > >

Re: what does "lost sys.stdin" error mean?

2009-06-11 Thread Tim Harig
On 2009-06-11, lynvie wrote: > I have a very simple program from the first chapter of a book on > python 3 (I'm a novice). I called the program tmp.py and the data > input file is sum.dat (just a list of numbers, 1 per line). When I > type into my command shell "tmp.py < sum.dat" I get an error fr

Win32 stdin redirection

2009-06-11 Thread Tim Harig
On 2009-06-11, Tim Harig wrote: > On 2009-06-11, lynvie wrote: >> I have a very simple program from the first chapter of a book on >> python 3 (I'm a novice). I called the program tmp.py and the data >> input file is sum.dat (just a list of numbers, 1 per line). When I >> type into my command she

Re: preferring [] or () in list of error codes?

2009-06-11 Thread Gunter Henriksen
> Try, then, this tuple: > >event_timestamp = (2009, 06, 04, 05, 02, 03) >(year, month, day, hour, minute, second) = event_timestamp > > A list would be wrong for this value, because each position in the > sequence has a specific meaning beyond its mere sequential position. Yet > it also ma

Re: preferring [] or () in list of error codes?

2009-06-11 Thread Ben Finney
Gunter Henriksen writes: > > Try, then, this tuple: > > > >event_timestamp = (2009, 06, 04, 05, 02, 03) > >(year, month, day, hour, minute, second) = event_timestamp > > I totally agree about anything to do with immutability, I think the > relative ordering of the elements in this exampl

Re: help with errror

2009-06-11 Thread Chris Rebert
On Thu, Jun 11, 2009 at 2:33 PM, tanner barnes wrote: > could some one explain this error to me and possibly how to fix it? > > Traceback (most recent call last): >   File "C:\Users\brandon\workspace\tanner's workshop\tanner's > workshop\src\WxGlade.py", line 458, in >     Edit = MyDialog2(None, -

Re: preferring [] or () in list of error codes?

2009-06-11 Thread Gunter Henriksen
> > >event_timestamp = (2009, 06, 04, 05, 02, 03) > > >(year, month, day, hour, minute, second) = event_timestamp > > > > [...] > > The point of each position having a different semantic meaning is that > tuple unpacking works as above. You need to know the meaning of each > position in ord

Specify the sorting direction for the various columns/

2009-06-11 Thread Oni
Managed to get a dictionary to sort on multiple columns using a tuple to set the sort order (see below). However how can I control that column "date" orders descending and the column "name" orders ascending. Thanks import datetime import pprint import operator faUserFormInput = {'DDPageSortOrder

Re: Convert integer to fixed length binary string

2009-06-11 Thread casebash
Thanks, this is what I needed On Jun 11, 9:40 pm, Ulrich Eckhardt wrote: > casebash wrote: > > I know the bin function converts an int into a binary string. > > Binary string sounds ambiguous. Firstly, everything is binary. Secondly, > strings are byte strings or Unicode strings. In any case, I'm

  1   2   >