Re: EOF problem with ENTER

2009-06-11 Thread Prasoon
On Jun 12, 11:28 am, Chris Rebert wrote: > On Thu, Jun 11, 2009 at 11:17 PM, Prasoon wrote: > > I am new to python > > I have written the following program in python.It is the solution of > > problem ETF in SPOJ. > > > #Euler Totient Function > > > from math import sqrt > > def etf(n): > >

Re: EOF problem with ENTER

2009-06-11 Thread Prasoon
On Jun 12, 11:28 am, Chris Rebert wrote: > On Thu, Jun 11, 2009 at 11:17 PM, Prasoon wrote: > > I am new to python > > I have written the following program in python.It is the solution of > > problem ETF in SPOJ. > > > #Euler Totient Function > > > from math import sqrt > > def etf(n): > >

Re: FW: [Tutor] Multi-Threading and KeyboardInterrupt

2009-06-11 Thread Graham Dumpleton
On Jun 12, 3:35 pm, Dennis Lee Bieber wrote: > On Thu, 11 Jun 2009 08:44:24 -0500, "Strax-Haber, Matthew (LARC-D320)" > declaimed the following in > gmane.comp.python.general: > > > I sent this to the Tutor mailing list and did not receive a response. > > Perhaps one of you might be able to offer

Re: EOF problem with ENTER

2009-06-11 Thread Chris Rebert
On Thu, Jun 11, 2009 at 11:17 PM, Prasoon wrote: > I am new to python > I have written the following program in python.It is the solution of > problem ETF in SPOJ. > > > #Euler Totient Function > > from math import sqrt > def etf(n): >   i,res =2,n >   while(i*i<=n): >      if(n%i==0): >  

EOF problem with ENTER

2009-06-11 Thread Prasoon
I am new to python I have written the following program in python.It is the solution of problem ETF in SPOJ. #Euler Totient Function from math import sqrt def etf(n): i,res =2,n while(i*i<=n): if(n%i==0): res-=res/i while(n%i==0): n/=i i+=1

Re: Win32 stdin redirection

2009-06-11 Thread lynvie
Thanks for the additional info! I had no idea this was an old Windows problem... I'm using Windows XP and I'm up-to-date on all my patches. The good news is I can invoke the script correctly now, thanks to your help! On Jun 11, 4:25 pm, Tim Harig wrote: > On 2009-06-11, Tim Harig wrote: > > >

Re: Specify the sorting direction for the various columns/

2009-06-11 Thread Mike Kazantsev
On Thu, 11 Jun 2009 18:54:56 -0700 (PDT) Oni wrote: > 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. ... > bob = entries > bob.sor

Re: Need help in Python regular expression

2009-06-11 Thread meryl
On Jun 11, 9:41 pm, "Mark Tolonen" wrote: > "meryl" wrote in message > > news:2d4d8624-043b-4f5f-ae2d-bf73bca3d...@p6g2000pre.googlegroups.com... > > > > > > > Hi, > > > I have this regular expression > > blockRE = re.compile(".*RenderBlock {\w+}") > > > it works if my source is "RenderBlock {CEN

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

2009-06-11 Thread Stefan Behnel
Johannes Bauer wrote: > 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 t

Re: Specify the sorting direction for the various columns/

2009-06-11 Thread Mark Tolonen
"Oni" wrote in message news:018f4fa2-7203-4c98-a313-da5584976...@z20g2000prh.googlegroups.com... 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

Re: Need help in Python regular expression

2009-06-11 Thread John S
On Jun 11, 10:30 pm, meryl wrote: > Hi, > > I have this regular expression > blockRE = re.compile(".*RenderBlock {\w+}") > > it works if my source is "RenderBlock {CENTER}". > > But I want it to work with > 1. RenderTable {TABLE} > > So i change the regexp to re.compile(".*Render[Block|Table] {\w+

Re: Need help in Python regular expression

2009-06-11 Thread Mark Tolonen
"meryl" wrote in message news:2d4d8624-043b-4f5f-ae2d-bf73bca3d...@p6g2000pre.googlegroups.com... Hi, I have this regular expression blockRE = re.compile(".*RenderBlock {\w+}") it works if my source is "RenderBlock {CENTER}". But I want it to work with 1. RenderTable {TABLE} So i change the

Re: TypeError: int argument required

2009-06-11 Thread alex23
On Jun 12, 1:56 pm, lucius wrote: >  w, h, absX, absY = result.group(3), result.group(4), result.group > (5), result.group(6) > > w = 100 > h = 200 > > absX = 10.0 > absY = 20.0 Are you sure those values are ints & floats? I would expect your regexp would be returning strings... Try replacing th

TypeError: int argument required

2009-06-11 Thread lucius
I am trying to print some values to a file (using c's printf like method). TypeError: int argument required # this works, i see value on screen print w, h, absX, absY # where result is the return value of my regular expression. w, h, absX, absY = result.group(3), result.group(4), result.group

Need help in Python regular expression

2009-06-11 Thread meryl
Hi, I have this regular expression blockRE = re.compile(".*RenderBlock {\w+}") it works if my source is "RenderBlock {CENTER}". But I want it to work with 1. RenderTable {TABLE} So i change the regexp to re.compile(".*Render[Block|Table] {\w+}"), but that breaks everything 2. RenderBlock (CENT

Problem with apsw and garbage collection

2009-06-11 Thread Nikolaus Rath
Hi, Please consider this example: #!/usr/bin/env python import apsw import tempfile fh = tempfile.NamedTemporaryFile() conn = apsw.Connection(fh.name) # Fill the db with some data cur = conn.cursor() datafh = open("/dev/urandom", "rb") cur.execute("CREATE TABLE foo (no INT, data BLOB)") for i

Socket packet timing on Windows 2000

2009-06-11 Thread sanyi jiang
hi *Tim Janick,* I encountered same problem, did you ever get some resolution? Brent Jiang, -- http://mail.python.org/mailman/listinfo/python-list

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

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: 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

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 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: 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

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: 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

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: 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: 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: 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: 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

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: 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,

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 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: 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: 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

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: 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

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: 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

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: 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: 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: 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: 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' >

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: 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

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: 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: 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: 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: 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

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: 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

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

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

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

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

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

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: 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... >> >

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 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 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 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: 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

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: 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.

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: 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: 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

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

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

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

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: 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: 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: .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

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: 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

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: 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: 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 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 > >

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: 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

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: 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 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 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: 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

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: 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

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 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: 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: 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: 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

  1   2   >