Re: Floating numbers and str

2005-11-09 Thread Christian Stapfer
Tuvas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I would like to limit a floating variable to 4 signifigant digits, when running thorugh a str command. Ei, x=.13241414515 y=str(x)+ something here But somehow limiting that to 4 sign. digits. I know that if you use the print

Re: Help! Python either hangs or core dumps when calling C malloc

2005-09-08 Thread Christian Stapfer
Lil [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I already double checked my C code. It runs perfectly fine in C without any errors. So in my python program, I added a pdb.set_trace() and step through the program and it did not dump. But when i took out the tracing, the core dump

Re: Removing duplicates from a list

2005-09-14 Thread Christian Stapfer
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I do this: def unique(keys): unique = [] for i in keys: if i not in unique:unique.append(i) return unique I don't know what is faster at the moment. This is quadratic, O(n^2), in the length n of the list if all

Re: reading files with error

2005-09-17 Thread Christian Stapfer
of these constants only. But since Python's file objects are implemented using C's stdio package, you can read http://www.opengroup.org/onlinepubs/009695399/functions/lseek.html Regards, Christian Stapfer -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparing lists

2005-10-10 Thread Christian Stapfer
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] try to use set. L1 = [1,1,2,3,4] L2 = [1,3, 99] A = set(L1) B = set(L2) X = A-B print X Y = B-A print Y Z = A | B print Z But how efficient is this? Could you be a bit more explicit on that

Re: Comparing lists

2005-10-10 Thread Christian Stapfer
George Sakkis [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Christian Stapfer [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: try to use set. Sorting the two lists and then extracting A-B, B-A, A|B, A B and A ^ B in one single pass seems to me very likely to be much

Re: Comparing lists

2005-10-10 Thread Christian Stapfer
Steve Holden [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Christian Stapfer wrote: George Sakkis [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Christian Stapfer [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: try to use set. Sorting the two lists

Re: Comparing lists

2005-10-11 Thread Christian Stapfer
Scott David Daniels [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Christian Stapfer wrote: Steve Holden [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Christian Stapfer wrote: George Sakkis [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Christian Stapfer

Re: Yes, this is a python question, and a serious one at that (moving to Win XP)

2005-10-13 Thread Christian Stapfer
John J. Lee [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Kenneth McDonald [EMAIL PROTECTED] writes: [...] absolutely preventing me from making the switch. Number one is the lack of a decent command line and command-line environment, and I'm wondering (hoping) if perhaps someone

Re: Comparing lists

2005-10-14 Thread Christian Stapfer
jon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] To take the heat out of the discussion: sets are blazingly fast. I'd prefer a (however) rough characterization of computational complexity in terms of Big-Oh (or Big-whatever) *anytime* to marketing-type characterizations like

Re: Comparing lists

2005-10-15 Thread Christian Stapfer
Steven D'Aprano [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sat, 15 Oct 2005 06:31:53 +0200, Christian Stapfer wrote: jon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] To take the heat out of the discussion: sets are blazingly fast. I'd prefer a (however

Re: Comparing lists

2005-10-15 Thread Christian Stapfer
Steven D'Aprano [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sat, 15 Oct 2005 18:17:36 +0200, Christian Stapfer wrote: I'd prefer a (however) rough characterization of computational complexity in terms of Big-Oh (or Big-whatever) *anytime* to marketing-type characterizations

Re: Comparing lists

2005-10-16 Thread Christian Stapfer
Ron Adam [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Christian Stapfer wrote: This discussion begins to sound like the recurring arguments one hears between theoretical and experimental physicists. Experimentalists tend to overrate the importance of experimental data (setting

Re: Comparing lists - somewhat OT, but still ...

2005-10-16 Thread Christian Stapfer
Ron Adam [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Christian Stapfer wrote: This discussion begins to sound like the recurring arguments one hears between theoretical and experimental physicists. Experimentalists tend to overrate the importance of experimental data (setting

Re: Comparing lists

2005-10-16 Thread Christian Stapfer
Fredrik Lundh [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Christian Stapfer wrote: As to the value of complexity theory for creativity in programming (even though you seem to believe that a theoretical bent of mind can only serve to stifle creativity), the story

Re: Comparing lists

2005-10-16 Thread Christian Stapfer
Ron Adam [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Christian Stapfer wrote: Ron Adam [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Christian Stapfer wrote: This discussion begins to sound like the recurring arguments one hears between theoretical and experimental

Re: Comparing lists - somewhat OT, but still ...

2005-10-16 Thread Christian Stapfer
Steven D'Aprano [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sun, 16 Oct 2005 15:16:39 +0200, Christian Stapfer wrote: Come to think of an experience that I shared with a student who was one of those highly creative experimentalists you seem to have in mind. He had just

Re: Comparing lists

2005-10-16 Thread Christian Stapfer
Steven D'Aprano [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sun, 16 Oct 2005 19:42:11 +0200, Christian Stapfer wrote: Pauli's prediction of the existence of the neutrino is another. It took experimentalists a great deal of time and patience (about 20 years, I am told) until

Re: Comparing lists

2005-10-17 Thread Christian Stapfer
Alex Martelli [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Christian Stapfer [EMAIL PROTECTED] wrote: This is why we would like to have a way of (roughly) estimating the reasonableness of the outlines of a program's design in armchair fashion - i.e. without having to write any

Re: Comparing lists

2005-10-17 Thread Christian Stapfer
Alex Martelli [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Christian Stapfer [EMAIL PROTECTED] wrote: Alex Martelli [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Christian Stapfer [EMAIL PROTECTED] wrote: This is why we would like to have a way of (roughly

Re: add an asynchronous exception class

2006-03-04 Thread Christian Stapfer
Paul Rubin http://[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Fredrik Lundh [EMAIL PROTECTED] writes: PEP 348 addresses this by moving special exceptions out of the Exception hierarchy: http://www.python.org/peps/pep-0348.html I see that suggestion was rejected (it needed

Re: add an asynchronous exception class

2006-03-04 Thread Christian Stapfer
Paul Rubin http://[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Christian Stapfer [EMAIL PROTECTED] writes: I guess it means the following: Terminating exceptions are exceptions that terminate the *thrower* of the exception. Are you sure? Am I sure? - Well no! As I wrote

Re: strange math?

2006-03-18 Thread Christian Stapfer
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello everyone, I'm experimenting with python and i'm following this tutorial: http://docs.python.org/tut/node6.html#SECTION00640 I'm in section 4.7.5 Lambda Forms. In this section I was working along and I noticed

Problem loading true-type font with PIL

2006-09-01 Thread Christian Stapfer
someone (more knowledgeable than myself as regards PIL and this true-type font loading business) please point me in the right direction? Many thanks in advance, Christian Stapfer -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem loading true-type font with PIL

2006-09-01 Thread Christian Stapfer
Christian Stapfer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] After switching from Python 2.3 to 2.4 (Enought), ^ I mean: Python Enthought Edition--Python 2.4.3 for Windows, sorry for that. I see in the documentation for PIL

Re: Problem loading true-type font with PIL - solved

2006-09-02 Thread Christian Stapfer
Christian Stapfer wrote: After switching from Python 2.3 to 2.4 (Enought), PIL throws an exception that did not occur formerly (under Python 2.3) when executing ImageFont.truetype(font, size) snip/ A module seems to be missing: do I have to install something in addition to PIL

Re: Problem loading true-type font with PIL - solved

2006-09-03 Thread Christian Stapfer
Robert Kern wrote: Fredrik Lundh wrote: Christian Stapfer wrote: Problem solved by rudely installing PIL 1.1.5 for Windows and Python 2.4 from http://www.pythonware.com/products/pil/ right on top of my existing Python Enthought Edition--Python 2.4.3 for Windows. This might have destroyed

Re: dynamic drawing in web page

2006-05-21 Thread Christian Stapfer
Paul Boddie [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] barbaros wrote: I need to put some dynamic drawings on my web page. More precisely, I need to draw a number of geometric figures (circles, rectangles) which evolve into a graphics windows according to some law (a little

Re: algorithm for sorting functional expressions

2006-12-04 Thread Christian Stapfer
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I am trying to write some code that will take a list of functional expressions, and order them so that those with primitive terms appear at the beginning of the list and those that are defined by other terms appear last. eg:

'LoadFile' not found when invoking Acrobat via wx.lib.pdfwin

2007-01-12 Thread Christian Stapfer
Hi, I get the following traceback when trying to have wx.lib.pdfwin.PDFWindow open a PDF file: E:\Tutoring\Teacher\Flashcardspython pdfwin1.py Traceback (most recent call last): File pdfwin1.py, line 50, in OnOpenButton self.pdf.LoadFile(dlg.GetPath()) File

Re: can't find a way to display and print pdf through python.

2007-02-11 Thread Christian Stapfer
krishnakant Mane wrote in message news:[EMAIL PROTECTED] On 11/02/07, Vishal Bhargava [EMAIL PROTECTED] wrote: Use Report Lab... I mentioned in my first email that I am already using reportlab. but I can only generate pdf out of that. I want to display it on screen and I also will be giving

Drawing glyphs based on their index (NOT their character code)

2010-05-20 Thread Christian Stapfer
Here's an interesting little problem: I am given a master.ttf font file and a subset file subset.ttf of that font, and I am asked to map indices of all the glyphs in subset.ttf to the corresponding indices in master.ttf. The subset font file is the result of a pipeline of 3 tools (pdflatex,

Re: Drawing glyphs based on their index (NOT their character code)

2010-05-20 Thread Christian Stapfer
Christian Stapfer nob...@nowhere.nil schrieb im Newsbeitrag news:b7256$4bf516e1$544ba447$20...@news.hispeed.ch... Here's an interesting little problem: I am given a master.ttf font file and a subset file subset.ttf of that font, and I am asked to map indices of all the glyphs in subset.ttf