python3 import idlelib.PyShell fails

2013-06-30 Thread Helmut Jarausch
Hi, I have a strange error. When I try import idlelib.PyShell from Python3.3 it fails with Python 3.3.2+ (3.3:68ff68f9a0d5+, Jun 30 2013, 12:59:15) [GCC 4.7.3] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import idlelib.PyShell Traceback (most recent call

Re: python3 import idlelib.PyShell fails

2013-06-30 Thread Helmut Jarausch
On Sun, 30 Jun 2013 13:20:24 +0200, Peter Otten wrote: Thanks a lot! Helmut. -- http://mail.python.org/mailman/listinfo/python-list

How to make this faster

2013-07-05 Thread Helmut Jarausch
Hi, I have coded a simple algorithm to solve a Sudoku (probably not the first one). Unfortunately, it takes 13 seconds for a difficult problem which is more than 75 times slower than the same algorithm coded in C++. Is this to be expected or could I have made my Python version faster *** without

Re: How to make this faster

2013-07-05 Thread Helmut Jarausch
On Fri, 05 Jul 2013 10:38:35 +0100, Fábio Santos wrote: > [Skipping to bottleneck] > >> def find_good_cell() : > > In this function you are accessing global variables a lot of times. Since > accessing globals takes much more time than accessing locals, I advise you > to assign them to local name

Re: How to make this faster

2013-07-05 Thread Helmut Jarausch
On Fri, 05 Jul 2013 11:13:33 +0100, Oscar Benjamin wrote: > My one comment is that you're not really making the most out of numpy > arrays. Numpy's ndarrays are efficient when each line of Python code > is triggering a large number of numerical computations performed over > the array. Because of t

Re: How to make this faster

2013-07-05 Thread Helmut Jarausch
On Fri, 05 Jul 2013 14:41:23 +0100, Oscar Benjamin wrote: > On 5 July 2013 11:53, Helmut Jarausch wrote: >> I even tried to use dictionaries instead of Numpy arrays. This version is a >> bit >> slower then the lists of lists version (7.2 seconds instead of 6 second) but &g

Re: How to make this faster

2013-07-05 Thread Helmut Jarausch
On Fri, 05 Jul 2013 12:02:21 +, Steven D'Aprano wrote: > On Fri, 05 Jul 2013 10:53:35 +, Helmut Jarausch wrote: > >> Since I don't do any numerical stuff with the arrays, Numpy doesn't seem >> to be a good choice. I think this is an argument to add real

Re: How to make this faster

2013-07-05 Thread Helmut Jarausch
On Fri, 05 Jul 2013 13:44:57 +0100, Fábio Santos wrote: May I suggest you avoid range and use enumerate(the_array) instead? It might be faster. How does this work? Given Grid= [[0 for j in range(9)] for i in range(9)] for (r,c,val) in (Grid) : Helmut -- http://mail.python.org/mailman/lis

Re: How to make this faster

2013-07-05 Thread Helmut Jarausch
On Fri, 05 Jul 2013 15:45:25 +0100, Oscar Benjamin wrote: > Presumably then you're now down to the innermost loop as a bottle-neck: > > Possibilities= 0 > for d in range(1,10) : > if Row_Digits[r,d] or Col_Digits[c,d] or Sqr_Digits[Sq_No,d] : > continue > Possibilitie

Re: How to make this faster

2013-07-05 Thread Helmut Jarausch
On Fri, 05 Jul 2013 16:18:41 +0100, Fábio Santos wrote: > On 5 Jul 2013 15:59, "Helmut Jarausch" wrote: >> >> On Fri, 05 Jul 2013 13:44:57 +0100, Fábio Santos wrote: >> May I suggest you avoid range and use enumerate(the_array) instead? It >> migh

Re: How to make this faster

2013-07-05 Thread Helmut Jarausch
On Fri, 05 Jul 2013 16:38:43 +0100, Oscar Benjamin wrote: > On 5 July 2013 16:17, Helmut Jarausch wrote: >> >> I've tried the following version >> >> def find_good_cell() : >> Best= None >> minPoss= 10 >> for r,c in Grid : >> i

Re: How to make this faster

2013-07-05 Thread Helmut Jarausch
On Fri, 05 Jul 2013 16:50:41 +, Steven D'Aprano wrote: > On Fri, 05 Jul 2013 16:07:03 +, Helmut Jarausch wrote: > >> The solution above take 0.79 seconds (mean of 100 calls) while the >> following version take 1.05 seconds (mean of 100 calls): > > 1) How ar

Re: How to make this faster

2013-07-05 Thread Helmut Jarausch
On Fri, 05 Jul 2013 17:25:54 +0100, MRAB wrote: > For comparison, here's my solution: Your solution is very fast, indeed. It takes 0.04 seconds (mean of 1000 runs) restoring "grid" in between. But that's a different algorithm which is IMHO more difficult to understand. Many thanks, Helmut > >

Re: How to make this faster

2013-07-06 Thread Helmut Jarausch
On Sat, 06 Jul 2013 03:05:30 +, Steven D'Aprano wrote: > That doesn't explain how you time it, only that you have a loop executing > 100 times. Are you using time.time, or time.clock? (I trust you're not > measuring times by hand with a stop watch.) > > I expect you're probably doing someth

Procedure to request adding a module to the standard library - or initiating a vote on it

2012-08-07 Thread Helmut Jarausch
ator" for Python. Should I try to contact him personally? Many thanks for a hint, Helmut Jarausch RWTH Aachen University Germany -- http://mail.python.org/mailman/listinfo/python-list

Re: Procedure to request adding a module to the standard library - or initiating a vote on it

2012-08-07 Thread Helmut Jarausch
On Tue, 07 Aug 2012 13:15:29 +0200, Peter Otten wrote: > I don't think that will help. From PEP 408: > > """ > As part of the same announcement, Guido explicitly accepted Matthew > Barnett's 'regex' module [4] as a provisional addition to the standard > library for Python 3.3 (using the 'regex' n

print(....,file=sys.stderr) buffered?

2012-08-13 Thread Helmut Jarausch
Hi, for tracing purposes I have added some print outs like print('+++ before calling foo',file=sys.stderr) x=foo(..) print('--- after calling foo', and within 'foo' print('>>> entering foo ...',file=sys.stderr) Now, when executing this, I always get +++ before calling foo --- after calling f

Re: print(....,file=sys.stderr) buffered?

2012-08-13 Thread Helmut Jarausch
On Mon, 13 Aug 2012 15:43:31 +, Grant Edwards wrote: > On 2012-08-13, Helmut Jarausch wrote: >> Hi, >> >> for tracing purposes I have added some print outs like >> >> print('+++ before calling foo',file=sys.stderr) >> x=foo(..) >> print(

email with a non-ascii charset in Python3 ?

2012-08-15 Thread Helmut Jarausch
Hi, I'm sorry to ask such a FAQ but still I couldn't find an answer - neither in the docs nor the web. What's wrong with the following script? Many thanks for a hint, Helmut. #!/usr/bin/python3 #_*_ coding: latin1 _*_ import smtplib from email.message import Message import datetime msg= Mess

Re: email with a non-ascii charset in Python3 ?

2012-08-15 Thread Helmut Jarausch
On Wed, 15 Aug 2012 14:48:40 +0200, Christian Heimes wrote: > Am 15.08.2012 14:16, schrieb Helmut Jarausch: >> Hi, >> >> I'm sorry to ask such a FAQ but still I couldn't find an answer - >> neither in the docs nor the web. >> >> What's wro

Python3.3 email policy date field

2012-08-23 Thread Helmut Jarausch
Hi, in response to a bug report I got the follow helpful comments from R. David Murray. Many thanks to him. (Unfortunately, I don't know his email, so I can write him directly) To generate an email (with non-ascii letters) R. David Murray wrote: >>> But even better, so will this: >>> m = Mes

Re: Python3.3 email policy date field

2012-08-23 Thread Helmut Jarausch
On Thu, 23 Aug 2012 12:36:01 +0100, MRAB wrote: > From what I've tried, it looks like the date can't be a string: > > >>> m['Date'] = datetime.datetime.utcnow() > >>> m['Date'] > 'Thu, 23 Aug 2012 11:33:20 -' Many thanks - it's even easier! Waiting for Python 3.3 to become standard! Helm

exec with partial globals

2012-10-30 Thread Helmut Jarausch
Hi, I'd like to give the user the ability to enter code which may only rebind a given set of names but not all ones. This does NOT work A=1 B=2 Code=compile('A=7','','exec') exec(Code,{'A':0}) print("I've got A={}".format(A)) # prints 1 How can 'filter' the gobal namespace such that modifying 'A

Re: exec with partial globals

2012-10-30 Thread Helmut Jarausch
On Tue, 30 Oct 2012 08:33:38 -0400, Dave Angel wrote: > On 10/30/2012 08:00 AM, Helmut Jarausch wrote: >> Hi, >> >> I'd like to give the user the ability to enter code which may only rebind >> a given set of names but not all ones. >> This does NOT w

Python3.3 str() bug?

2012-11-09 Thread Helmut Jarausch
Hi, probably I'm missing something. Using str(Arg) works just fine if Arg is a list. But str([],encoding='latin-1') gives the error TypeError: coercing to str: need bytes, bytearray or buffer-like object, list found If this isn't a bug how can I use str(Arg,encoding='latin-1')

Re: Python3.3 str() bug?

2012-11-09 Thread Helmut Jarausch
On Fri, 09 Nov 2012 10:37:11 +0100, Stefan Behnel wrote: > Helmut Jarausch, 09.11.2012 10:18: >> probably I'm missing something. >> >> Using str(Arg) works just fine if Arg is a list. >> But >> str([],encoding='latin-1') >> >&g

Re: Python3.3 str() bug?

2012-11-09 Thread Helmut Jarausch
On Fri, 09 Nov 2012 23:22:04 +1100, Chris Angelico wrote: > On Fri, Nov 9, 2012 at 10:08 PM, Helmut Jarausch > wrote: >> For me it's not funny, at all. > > His description "funny" was in reference to the fact that you > described this as a bug. This is a hea

python3.3 - tk_setPalette bug?

2012-11-23 Thread Helmut Jarausch
Hi, AFAIK, this should work: import tkinter as Tk root= Tk.Tk() root.tk_setPalette(background = 'AntiqueWhite1', foreground = 'blue') but python-3.3:0e4574595674+ gives Traceback (most recent call last): File "Matr_Select.py", line 174, in root.tk_setPalette(background = 'AntiqueWhite1',

email.message.Message - as_string fails

2012-12-28 Thread Helmut Jarausch
Hi, I'm trying to filter an mbox file by removing some messages. For that I use Parser= FeedParser(policy=policy.SMTP) and 'feed' any lines to it. If the mbox file contains a white line followed by '^From ', I do Msg= Parser.close() (lateron I delete the Parser and create a new one by Parser= F

Re: email.message.Message - as_string fails

2012-12-29 Thread Helmut Jarausch
On Fri, 28 Dec 2012 20:57:46 -0500, Terry Reedy wrote: > On 12/28/2012 7:22 AM, Helmut Jarausch wrote: >> Hi, >> >> I'm trying to filter an mbox file by removing some messages. >> For that I use Parser= FeedParser(policy=policy.SMTP) >> and 'feed'

re: ignore case only for a part of the regex?

2012-12-30 Thread Helmut Jarausch
Hi, is there a means to specify that 'ignore-case' should only apply to a part of a regex? E.g. the regex should match Msg-id:, Msg-Id, ... but not msg-id: and so on. I've tried the pattern r'^Msg-(?:(?i)id):' but (?i) makes the whole pattern ignoring case. In my simple case I could say r'M

numpy.genfromtxt with Python3 - howto

2012-04-06 Thread Helmut Jarausch
Hi I have a machine with a non-UTF8 local. I can't figure out how to make numpy.genfromtxt work I pipe some ascii data into the following script but get this bytes to str hell. Many thanks for a hint, Helmut. #!/usr/bin/python3 import numpy as np import io import sys inpstream = io.open(sys.s

Re: Is it possible to open a dbf

2005-01-03 Thread Helmut Jarausch
Yes, "dBase Python" yields only some code for reading dBase ... and lots of enquires about such a thing... I've been using http://www.fiby.at/dbfpy/ without any problems including writing/modifying dbf files. -- Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen Universi

Re: regex question

2005-06-25 Thread Helmut Jarausch
?:\s+(\d))*' + '$' > match = re.match(regex, line) > print "lastindex is: ",match.lastindex > print "matches: ",match.group(1) > > > Obviously I do not understand how (?:\s+(\d))* works in conjunction with > ^ and $. > I am sure

BaseHTTPServer and priviledge separation?

2005-06-25 Thread Helmut Jarausch
Hi, to use a port below 1000 on a Unix system one needs root priviledges. But it's dangerous to execute all of a script under those priviledges. Therefore I'd like to drop the root priviledges as soon as possible. (How) is this possible? Many thanks for a hint, Helmut Jarausch Lehr

extracting a heapq in a for loop - there must be more elegant solution

2013-12-03 Thread Helmut Jarausch
Hi, I'd like to extracted elements from a heapq in a for loop. I feel my solution below is much too complicated. How to do it more elegantly? I know I could use a while loop but I don't like it. Many thanks for some lessons in Python. Here is my clumsy solution from heapq import heappush, heap

Re: extracting a heapq in a for loop - there must be more elegant solution

2013-12-04 Thread Helmut Jarausch
On Tue, 03 Dec 2013 04:40:26 -0800, rusi wrote: > On Tuesday, December 3, 2013 5:48:59 PM UTC+5:30, Helmut Jarausch wrote: >> Hi, >> >> I'd like to extracted elements from a heapq in a for loop. >> I feel my solution below is much too complicated. >> How

Re: extracting a heapq in a for loop - there must be more elegant solution

2013-12-04 Thread Helmut Jarausch
On Tue, 03 Dec 2013 13:38:58 +0100, Peter Otten wrote: > Helmut Jarausch wrote: > >> Hi, >> >> I'd like to extracted elements from a heapq in a for loop. >> I feel my solution below is much too complicated. >> How to do it more elegantly? >> I kn

Re: extracting a heapq in a for loop - there must be more elegant solution

2013-12-04 Thread Helmut Jarausch
On Tue, 03 Dec 2013 13:06:05 +, Duncan Booth wrote: > Helmut Jarausch wrote: > >> Hi, >> >> I'd like to extracted elements from a heapq in a for loop. >> I feel my solution below is much too complicated. >> How to do it more elegantly? >> I

Re: extracting a heapq in a for loop - there must be more elegant solution

2013-12-04 Thread Helmut Jarausch
On Tue, 03 Dec 2013 15:56:11 +0200, Jussi Piitulainen wrote: > Helmut Jarausch writes: > ... >> I know I could use a while loop but I don't like it. > ... >> from heapq import heappush, heappop >> # heappop raises IndexError if heap is empty > ... >>

Re: extracting a heapq in a for loop - there must be more elegant solution

2013-12-04 Thread Helmut Jarausch
On Wed, 04 Dec 2013 08:13:03 +1100, Cameron Simpson wrote: > On 03Dec2013 12:18, Helmut Jarausch wrote: >> I'd like to extracted elements from a heapq in a for loop. >> I feel my solution below is much too complicated. >> How to do it more elegantly? > > I ca

smart splitting - how to

2013-12-13 Thread Helmut Jarausch
Hi, I'd like to read several strings by using 'input'. These strings are separated by white space but I'd like to allow for some quoting, e.g. "Guido van" Rossum should be split into 2 strings only Now, a simple split doesn't work since it splits the quoted text as well. Is there a simple way

Re: smart splitting - how to

2013-12-13 Thread Helmut Jarausch
On Fri, 13 Dec 2013 11:39:57 +, Chris Angelico and Robert Kern wrote: > On 2013-12-13 11:28, Helmut Jarausch wrote: >> Hi, >> >> I'd like to read several strings by using 'input'. >> These strings are separated by white space but I'd like to a

Python3 - temporarily change the file encoding

2014-03-21 Thread Helmut Jarausch
Hi, my locale is en_US.iso88591 But now I'd like to process a restructuredtext file which is encoded in utf-8. rst2html has #!/usr/bin/python3.3 # $Id: rst2html.py 4564 2006-05-21 20:44:42Z wiemann $ # Author: David Goodger # Copyright: This module has been placed in the public domain. """ A

__iadd__ for a subclass of array - howto

2013-08-05 Thread Helmut Jarausch
Hi, I'd like to subclass array.array and implement operators like __iadd__ How can this be accomplished. I'tried from array import array class Vec(array) : def __new__(cls,Vinit) : return array.__new__(cls,'d',Vinit) def __init__(self,*args) : self.N = len(self) def __str__(self

Python3 exec locals - this must be a FAQ

2013-02-12 Thread Helmut Jarausch
Hi, I've tried but didn't find an answer on the net. The exec function in Python modifies a copy of locals() only. How can I transfer changes in that local copy to the locals of my function ** without ** knowing the names of these variables. E.g. I have a lot of local names. Doing _locals= l

Re: Python3 exec locals - this must be a FAQ

2013-02-12 Thread Helmut Jarausch
On Tue, 12 Feb 2013 08:27:41 -0500, Dave Angel wrote: > On 02/12/2013 06:46 AM, Helmut Jarausch wrote: >> Hi, >> >> I've tried but didn't find an answer on the net. >> >> The exec function in Python modifies a copy of locals() only. >> How can I

raw format string in string format method?

2013-02-28 Thread Helmut Jarausch
Hi, I'd like to print a string with the string format method which uses {0}, ... Unfortunately, the string contains TeX commands which use lots of braces. Therefore I would have to double all these braces just for the format method which makes the string hardly readable. Is there anything like a

Re: raw format string in string format method?

2013-02-28 Thread Helmut Jarausch
On Fri, 01 Mar 2013 01:22:48 +1100, Chris Angelico wrote: > On Fri, Mar 1, 2013 at 1:11 AM, Helmut Jarausch > wrote: >> Hi, >> >> I'd like to print a string with the string format method which uses >> {0}, ... >> >> Unfortunately, the string co

new.instancemethod - how to port to Python3

2013-04-07 Thread Helmut Jarausch
Hi, I'm trying to port a class to Python3.3 which contains class Foo : def to_binary(self, *varargs, **keys): self.to_binary = new.instancemethod(to_binary, self, self.__class__) # Finally call it manually return apply(self.to_binary, varargs, key

Re: new.instancemethod - how to port to Python3

2013-04-07 Thread Helmut Jarausch
On Sun, 07 Apr 2013 11:41:46 +0100, Arnaud Delobelle wrote: > On 7 April 2013 10:50, Helmut Jarausch wrote: >> Hi, >> >> I'm trying to port a class to Python3.3 which contains >> >> class Foo : >>

Re: new.instancemethod - how to port to Python3

2013-04-07 Thread Helmut Jarausch
On Sun, 07 Apr 2013 11:07:07 +, Steven D'Aprano wrote: > On Sun, 07 Apr 2013 10:54:46 +, Helmut Jarausch wrote: > >> class Foo : >> >> def to_binary(self, *varargs, **keys): >> >>code= ... >>

Re: new.instancemethod - how to port to Python3

2013-04-07 Thread Helmut Jarausch
On Sun, 07 Apr 2013 10:52:11 +, Steven D'Aprano wrote: > On Sun, 07 Apr 2013 09:50:35 +, Helmut Jarausch wrote: > >> Hi, >> >> I'm trying to port a class to Python3.3 which contains >> >> class Foo : >>

NNTPlib::xover problem

2006-08-07 Thread Helmut Jarausch
t;/usr/local/lib/python2.4/nntplib.py", line 219, in getresp raise NNTPTemporaryError(resp) NNTPTemporaryError: 420 No such article I would have expected to get an empty 'Response' or the value None for 'Articles'. What am I missing? (This is Python 2.4.3) Many thanks for

Re: NNTPlib::xover problem

2006-08-07 Thread Helmut Jarausch
se no articles are present. Thanks, though the name of the exception 'nntplib.NNTPTemporaryError' sound 'temporary' Helmut. > Op 7-aug-2006, om 12:50 heeft Helmut Jarausch het volgende geschreven: > >> Hi >> >> I try to regularly extract recent

Re: hide python code !

2006-08-11 Thread Helmut Jarausch
John Machin wrote: > Bayazee wrote: >> hi >> can we hide a python code ? >> if i want to write a commercial software can i hide my source code from > [1] >> users access ? >> we can conver it to pyc but this file can decompiled ... so ...!! >> do

Python in a nutshell - new edition ?

2006-06-28 Thread Helmut Jarausch
Hi, is there a new edition of "Python in a Nutshell" covering Python 2.5 coming soon? Many thanks, Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org/mailman/listinfo/python-list

How to terminate a main script?

2006-07-11 Thread Helmut Jarausch
same is true for an exception. And setting a 'flag' and testing at several place for 'fall through' is ugly and error-prone. So what is a good choice? Many thanks for a hint, Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany --

Re: How to terminate a main script?

2006-07-11 Thread Helmut Jarausch
Fredrik Lundh wrote: > Helmut Jarausch wrote: > >> Using sys.exit(0) produces an error >> message which looks dangerous to an >> uninitiated user. > > sys.exit(0) doesn't print anything at all. Yes, sorry, I was trying in in 'idle' There you g

upgrade 2.4 -> 2.5 HowTo

2006-09-04 Thread Helmut Jarausch
hint, Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org/mailman/listinfo/python-list

Re: upgrade 2.4 -> 2.5 HowTo

2006-09-04 Thread Helmut Jarausch
Sibylle Koczian wrote: > Helmut Jarausch schrieb: >> Hi, >> >> what has to be done for upgrading from Python 2.4 to 2.5? >> >> - How can I find out which packages (in addition to the core packages) >> have been >> installed up to now >> - Can I

Re: Test for number?

2006-09-04 Thread Helmut Jarausch
x27;) > ... try: > ... x=int(x) > ... print x, "is a number between 1 & 20 " > ... except: > ... print x, "is not a number" > ... >>>> numtest() # enter 1 > 1 is a number between 1 & 20 >>>> numtes

Re: mutable numeric type

2007-01-02 Thread Helmut Jarausch
[EMAIL PROTECTED] wrote: > Way to go. > Try doing this. > x = MutableNumeric(42) ^^ where is this defined? > y = x > x += 42 > print y > -- Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- h

python2.5 frameobject - how to upgrade?

2007-01-02 Thread Helmut Jarausch
Hi, I'd like to install a package ('rekall') which uses frame->f_nlocals which is no longer contained in frameobject.h What's the recommended way to upgrade such an application? Many thanks for a hint, Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aa

Re: python2.5 frameobject - how to upgrade?

2007-01-02 Thread Helmut Jarausch
> I suspect PySequence_Length(frame->f_locals) will do the trick. Yes, thanks, that fixed it, Happy New Year to you. A personal question: Have you converted from Perl to Python, as well? -- Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germa

Re: File processing - is Python suitable?

2007-06-19 Thread Helmut Jarausch
's one of the great strength of Python. Just some pointers http://gnosis.cx/TPiP/ http://www.egenix.com/products/python/mxBase/mxTextTools/ -- Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org/mailman/listinfo/python-list

restructuredtext latin1 encoding (FAQ?)

2007-07-03 Thread Helmut Jarausch
Hi, I did try to find something on the net but I couldn't find anything useful. Is there a way to write documents with the reST tools using the Latin1 encoding? Many thanks for a hint, Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Ge

Re: restructuredtext latin1 encoding (FAQ?)

2007-07-03 Thread Helmut Jarausch
Marc 'BlackJack' Rintsch wrote: > On Tue, 03 Jul 2007 12:12:04 +0200, Helmut Jarausch wrote: > >> Is there a way to write documents with the reST tools using the Latin1 >> encoding? > > Yes of course there is. Just write the documents in Latin-1 encoding. &g

wxPython Cannot convert from the charset 'latin-1'

2007-07-03 Thread Helmut Jarausch
How can I find out where this did come from. Running it under pdb isn't helpful either. Many thanks for a hint, Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org/mailman/listinfo/python-list

ReSTedit ported to Linux?

2007-07-04 Thread Helmut Jarausch
Hi, does anybody know if ReSTedit (originally for Mac OS X) has been ported to Linux? Many thanks for a hint, Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple search and Display system, no need for db?

2007-07-11 Thread Helmut Jarausch
nd of structure can we use in python? in web? > What about using a simple dictionary in Python. You can use the module pickle (or cpickle) to dump it to disk and load it next time. Furthermore you can easily write the whole web server in Python, e.g. I like http://karrigell.sourceforge.net/

Re: pattern match !

2007-07-11 Thread Helmut Jarausch
P=re.compile(r'(\w+(?:[-.]\d+)+)-RHEL3-Linux\.RPM') S="hpsmh-1.1.1.2-0-RHEL3-Linux.RPM" PO= P.match(S) if PO : print PO.group(1) -- Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org/mailman/listinfo/python-list

split a string of space separated substrings - elegant solution?

2007-07-31 Thread Helmut Jarausch
ion - perhaps without using a lexer and something else. With regular expressions alone it seems clumsy. Many thanks for a hint, Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org/mailman/listinfo/python-list

Re: split a string of space separated substrings - elegant solution?

2007-08-01 Thread Helmut Jarausch
Many thanks to all of you! It's amazing how many elegant solutions there are in Python. -- Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org/mailman/listinfo/python-list

decorators - more than just syntactic sugar

2007-08-11 Thread Helmut Jarausch
Hi, are decorators more than just syntactic sugar in python 2.x and what about python 3k ? How can I find out the predefined decorators? Many thanks for your help, Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org

Re: Drawing a graph

2007-08-13 Thread Helmut Jarausch
IL? > What about Gnuplot.py http://gnuplot-py.sourceforge.net/ -- Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org/mailman/listinfo/python-list

sendmail a long message

2007-11-21 Thread Helmut Jarausch
this. Is there an alternative solution, e.g. where smtplib.SMTP.sendmail calls a generator. Many thanks for a hint, Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org/mailman/listinfo/python-list

Re: sendmail a long message

2007-11-21 Thread Helmut Jarausch
Laszlo Nagy wrote: > Helmut Jarausch wrote: >> Hi, >> >> to send a possibly long email I have seen a solution >> which does os.popen to an external sendmail program and >> then writes the message into that pipe. >> >> I wonder if it possible to u

asynchronous timer events - how to?

2008-01-09 Thread Helmut Jarausch
red. While this function is running I need access to the variables of the server. Can this be done in a simple way? Many thanks for a hint, Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org/mailman/listinfo/python-list

Re: asynchronous timer events - how to?

2008-01-09 Thread Helmut Jarausch
Fredrik Lundh wrote: > Helmut Jarausch wrote: > >> I'm using a web server (Karrigell) which is based on the asyncore module. >> I'd like to be able to checkpoint some data (e.g. pickled >> dictionaries) to disk >> from time to time. >> For that I wo

module finalizer - is there such a beast?

2008-01-11 Thread Helmut Jarausch
thanks for a hint, Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org/mailman/listinfo/python-list

common problem - elegant solution sought

2008-01-15 Thread Helmut Jarausch
Most probably there are much more elegant solutions. Unfortunately, the index-list-method doesn't take an additional function argument for the comparisons. Many thanks for your hints, Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org/mailman/listinfo/python-list

Re: common problem - elegant solution sought

2008-01-15 Thread Helmut Jarausch
Thanks to you all for your help. The solution to regenerate the list skipping the one to be deleted is fine for me since my lists are of moderate size and the operation is infrequent. Helmut. -- Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen

Re: common problem - elegant solution sought

2008-01-15 Thread Helmut Jarausch
Neil Cerutti wrote: > On Jan 15, 2008 5:33 AM, Helmut Jarausch <[EMAIL PROTECTED]> wrote: >> Hi, >> >> I'm looking for an elegant solution of the following tiny but common problem. >> >> I have a list of tuples (Unique_ID,Date) both of which are str

Benchmark [was Re: common problem - elegant solution sought]

2008-01-15 Thread Helmut Jarausch
Again, many thanks to all who provide their solution. I have timed these (though on my old P3(0.9GHz)) - see below Helmut. Helmut Jarausch wrote: > Hi, > > I'm looking for an elegant solution of the following tiny but common > problem. > > I have a list of tuples (

Re: Benchmark [was Re: common problem - elegant solution sought]

2008-01-15 Thread Helmut Jarausch
Paul Rubin wrote: > Helmut Jarausch <[EMAIL PROTECTED]> writes: >> def del_by_key(L,key) : >>for pos, (k,d) in enumerate(L): >> if k == key : >>del L[pos] >>break > > This looks very dangerous, mutating L while iterating ove

Re: super, decorators and gettattribute

2008-01-15 Thread Helmut Jarausch
Michele Simionato wrote: > I really need to publish this one day or another, since these > questions > about super keeps coming out: > > http://www.phyast.pitt.edu/~micheles/python/super.html Unfortunately the links [2], [3] and [4] are not given, Helmut. -- Helmut Jarausch

ctypes CDLL - which paths are searched?

2008-01-21 Thread Helmut Jarausch
Hi, how can I specify the paths to be searched for a dynamic library to be loaded by ctypes' CDLL class on a Linux system. Do I have to set os.environment['LD_LIBRARY_PATH'] ? Many thanks for a hint, Helmut. -- Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aach

Re: ctypes CDLL - which paths are searched?

2008-01-22 Thread Helmut Jarausch
Thomas Heller wrote: > Helmut Jarausch schrieb: >> Hi, >> >> how can I specify the paths to be searched for a dynamic library >> to be loaded by ctypes' CDLL class on a Linux system. >> >> Do I have to set os.environment['LD_LIBRARY_PATH'] ?

Re: Removing objects

2008-01-23 Thread Helmut Jarausch
;,N.key,"->" N= N.NNd if N != None: print "next: ",N.key,"->" else: print "no next:" for N in MyQ: print "loop->",N print N.key,N.data MyQ.dequeue(MyQ.Tail) print "--- after dequeue" print "Head: &

Re: global/local variables

2008-01-25 Thread Helmut Jarausch
as they fulfill a unique function. Also, I think it's > more convenient, and I am, after all, my own employer when it comes to > programming. -- Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org/mailman/listinfo/python-list

Tkinter - incremental input ?

2008-01-30 Thread Helmut Jarausch
her words I need to know at which character position the last character was entered. Currently I can only see the brute force method: keeping track of all cursor positioning means like , , the '<-' and '->' keys and mouse clicks. Is there an easier method? Many thank

Re: Trouble loading dll via ctypes

2008-01-30 Thread Helmut Jarausch
ted directory are different, especial for user 'root'. Check if can execute some executable in that NFS path. Helmut. -- Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org/mailman/listinfo/python-list

Re: Sine Wave Curve Fit Question

2008-01-30 Thread Helmut Jarausch
(C'*C) * D= C'*Y where S'*C is the scalar product of the vectors S and C and similarly. Now, for Python, to handle vectors and scalar products efficiently, have a look at numpy. -- Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org/mailman/listinfo/python-list

Re: Sine Wave Curve Fit Question

2008-01-31 Thread Helmut Jarausch
Mikael Olofsson wrote: > Helmut Jarausch wrote: >> Your model is A*sin(omega*t+alpha) where A and alpha are sought. >> Let T=(t_1,...,t_N)' and Y=(y_1,..,y_N)' your measurements (t_i,y_i) >> ( ' denotes transposition ) >> >> First, A*sin(omega*t

helper function in a class' namespace

2008-01-31 Thread Helmut Jarausch
ss without (the overhead of) passing a 'self' or a 'cls' parameter? Probably I'm hurt by my C++ history. Many thanks for your help, Helmut. -- Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org/mailman/listinfo/python-list

Re: a trick with lists ?

2008-02-08 Thread Helmut Jarausch
ter_list) if ll > 0 : outer_list= outer_list[:ll-1] mylist=[1,2,3] MyClass2().shorten_list(mylist) print mylist # this prints [1, 2, 3] The shortened list outer_list[:ll-1] has been assigned (bound in Python terms) to the LOCAL reference (to a list) 'outer_li

Tkinter equiv for setPalette

2008-02-10 Thread Helmut Jarausch
hole application (root window and its children) Many thanks for a hint, Helmut. -- Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org/mailman/listinfo/python-list

Tkinter - tk_focusNext broken for years?

2008-02-10 Thread Helmut Jarausch
", line 6, in Proc_Enter Event.widget.tk_focusNext() File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 479, in tk_focusNext return self._nametowidget(name) File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 1064, in nametowidget if name[0] == '.'

Re: Why the result same as before modifing py files

2008-02-20 Thread Helmut Jarausch
zaley wrote: > In my C++ program ,python is embeded . I import One module(py file) > and execute some functions .Then I modify py files in order to modify > func parameters when process is still running .I import the module and > execute functions again.But I find the result is same as before 'im

  1   2   >