Re: code optimization (calc PI) / Full Code of PI calc in Python and C.

2007-01-03 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Michael M. wrote: > * The C is very fast, Python not. > * Target: Do optimization, that Python runs nearly like C. As someone else already asked: Why? You can't beat a compiled to machine code language with an interpreted one when doing integer arithmetic. > counter=c >

Re: code optimization (calc PI) / Full Code of PI calc in Python and C.

2007-01-03 Thread casevh
Michael M. wrote: > Ok, here is the code. It is a translation of the following code, found > on the internet. > > * The C is very fast, Python not. > * Target: Do optimization, that Python runs nearly like C. There is an error in the translated code. It returns 1600 digits instead of 800 digits.

Re: question on creating class

2007-01-03 Thread tonisk
Or if you have required class name in variable, then use: class TestClass: pass globals()[className] = TestClass -- Tõnis On Jan 4, 9:27 am, "wcc" <[EMAIL PROTECTED]> wrote: > Hello, > > How do I create a class using a variable as the class name? > > For example, in the code below, I'd like

Re: MI5 Persecution: Counter-surveillance sweep by Nationwide Investigations Group

2007-01-03 Thread bryan rasmussen
>As I said above, I don't know very much > about these things, so I can't comment on the capabilities or otherwise of > this equipment. >But clearly the "watchers" are using > technology which in 1994 was beyond the detection capabilities of a good > private detective >agency. > Lisp did that 20

Re: question on creating class

2007-01-03 Thread tonisk
You can always rename your defined clas afterwards class TestClass: pass myClass = TestClass -- Tõnis On Jan 4, 9:27 am, "wcc" <[EMAIL PROTECTED]> wrote: > Hello, > > How do I create a class using a variable as the class name? > > For example, in the code below, I'd like replace the line >

question on creating class

2007-01-03 Thread wcc
Hello, How do I create a class using a variable as the class name? For example, in the code below, I'd like replace the line class TestClass(object): with something like class eval(className) (object): Is it possible? Thanks for your help. className = "TestClass" class TestClass(object):

MI5 Persecution: Counter-surveillance sweep by Nationwide Investigations Group

2007-01-03 Thread MI5Victim
Counter-surveillance sweep by Nationwide Investigations Group In July 1994 the private detective agency Nationwide Investigations Group conducted an electronic counter-surveillance sweep of my parents' home in London. They checked for radio transmitter devices, and tested the telephone line for

Re: new office formats, REs and Python

2007-01-03 Thread Fredrik Lundh
tubby wrote: > How are Python users dealing with some of the new OASIS Open Document > formats (Open Office) or MS Open XML formats. These formats store data > in a file which is actual a zip archive that contains numerous files and > folders. For example, a file saved from Open Office 2.0 name

where to ask questions related to comtypes?

2007-01-03 Thread wcc
Hello group, Is there a separate mailing list for comtypes? Or this is the appropriate place to post questions related to this package(from Thomas Heller)? Thanks, -- wcc -- http://mail.python.org/mailman/listinfo/python-list

Re: Unsubscribing from the list

2007-01-03 Thread Dotan Cohen
On 03/01/07, Jan Dries <[EMAIL PROTECTED]> wrote: > Dotan Cohen wrote: > > On 03/01/07, Robert Kern <[EMAIL PROTECTED]> wrote: > >> He misunderstood you (as I nearly did, too). The way you phrased "decided > >> that > >> there was no futher interest on the page for me" is somewhat ambiguous: it >

Re: code optimization (calc PI) / Full Code of PI calc in Python and C.

2007-01-03 Thread Steven D'Aprano
On Thu, 04 Jan 2007 02:10:44 +0100, Michael M. wrote: > print "\nTiming a 1 million loop 'for loop' ..." > start = time.clock() > for x in range(100): >y = x # do something Why not "pass # do nothing"? > end = time.clock() > print "Time elapsed = ", end - start, "seconds" Are you awar

Re: Cannot build 2.5 on FC6 x86

2007-01-03 Thread Frank Millman
Paul Watson wrote: > Martin v. Löwis wrote: > > Paul Watson schrieb: > >> ./configure > >> make > >> make test > >> > >> The result appears to hang after the test_tkl... line. I had to kill > >> the 'make test' process which terminated it. Any suggestions? > > > > Sorry, I mis-typed. It is not

ANN: Urwid 0.9.7.2 - Console UI Library

2007-01-03 Thread Ian Ward
Announcing Urwid 0.9.7.2 Urwid home page: http://excess.org/urwid/ Tarball: http://excess.org/urwid/urwid-0.9.7.2.tar.gz About this release: === This maintenance release significantly improves the performance of Urwid when run in UTF-8 mode. A UT

Re: Iterate through list two items at a time

2007-01-03 Thread Wade Leftwich
Jeffrey Froman wrote: > Dave Dean wrote: > > > I'm looking for a way to iterate through a list, two (or more) items at a > > time. > > Here's a solution, from the iterools documentation. It may not be the /most/ > beautiful, but it is short, and scales well for larger groupings: > > >>> from iter

Re: Cannot build 2.5 on FC6 x86

2007-01-03 Thread Paul Watson
Martin v. Löwis wrote: > Paul Watson schrieb: >> ./configure >> make >> make test >> >> The result appears to hang after the test_tkl... line. I had to kill >> the 'make test' process which terminated it. Any suggestions? > > There isn't (or shouldn't be) any "test_tkl..." line. What precisely >

Re: How do I add users using Python scripts on a Linux machine

2007-01-03 Thread [EMAIL PROTECTED]
I find that I can often live with a 0-60 sec. pause. and set command in a queue like then have a cron that runs once a min as the user you need to run this on that looks at the queue and sees if there are any pending I often use a sql database for this -- http://mail.python.org/mailman/listinfo

Re: code optimization (calc PI) / Full Code of PI calc in Python and C.

2007-01-03 Thread bearophileHUGS
Michael M.: > * The C is very fast, Python not. > * Target: Do optimization, that Python runs nearly like C. Python can't be fast as C for that kind of programs. Note that your original C program gives less digits than the Python program. Your original takes about ~15.2 s on my PC. The following v

Re: code optimization (calc PI) / Full Code of PI calc in Python and C.

2007-01-03 Thread Gabriel Genellina
At Wednesday 3/1/2007 22:10, Michael M. wrote: Ok, here is the code. It is a translation of the following code, found on the internet. * The C is very fast, Python not. * Target: Do optimization, that Python runs nearly like C. Why? Python is strong in other aspects, *not* on computation spee

Re: C/C++, Perl, etc. to Python converter

2007-01-03 Thread Diez B. Roggisch
> > I think that it *is* possible to do it, but a whole lot of work had to > be done to achieve this. It is all about how many rules (like how to > convert this block of unreadable code of language X into a readable > python block) you are willing to find/program (and these are a lot). It > is a

Re: static object

2007-01-03 Thread Ben Finney
meelab <[EMAIL PROTECTED]> writes: > In other words, that is a class which would result in only 1 instance > always the same no matter how many times I will "instantiate" it. The "Singleton" pattern does what you say here. Implementing a proper Singleton in Python is complicated and hard to under

Re: Sorting on multiple values, some ascending, some descending

2007-01-03 Thread bearophileHUGS
dwelden wrote: > >L.sort(key=lambda r: r.secondary, reverse=True) > >L.sort(key=lambda r: r.primary) > Excellent! That looks just like what I needed. Note that there is the (probably little used) operator.attrgetter() too, with that you can avoid the possibly slow lambda: L.sort(key=attrge

Re: code optimization (calc PI) / Full Code of PI calc in Python and C.

2007-01-03 Thread Michael M.
Ok, here is the code. It is a translation of the following code, found on the internet. * The C is very fast, Python not. * Target: Do optimization, that Python runs nearly like C. Auf 800 Stellen in 160 Zeichen... -- int a=1,b,c=2800,d,e,f[2801],g;main(){for(;b-c;)f[b++]=a/5; for

new office formats, REs and Python

2007-01-03 Thread tubby
How are Python users dealing with some of the new OASIS Open Document formats (Open Office) or MS Open XML formats. These formats store data in a file which is actual a zip archive that contains numerous files and folders. For example, a file saved from Open Office 2.0 named 'test.odt' can be u

Re: code optimization (calc PI)

2007-01-03 Thread Matimus
> If someone is really interested in speed optimization, I can publish my > PI-calc code. I wouldn't mind seeing it. Chances are you will get much better help if you post your code anyway. -Matt -- http://mail.python.org/mailman/listinfo/python-list

Re: code optimization (calc PI)

2007-01-03 Thread Gabriel Genellina
At Wednesday 3/1/2007 12:50, mm wrote: Hmm... it's a question. It was not that easy to translate this [EMAIL PROTECTED] C-Program into readable code and then to Python. But it works. Because that code was written with C in mind, and uses some C subtlecies (uhm, got it right?) obscuring the or

Re: static object

2007-01-03 Thread Felipe Almeida Lessa
On 1/3/07, meelab <[EMAIL PROTECTED]> wrote: > I am looking for a way to create a "static object" or a "static class" - > terms might be inappropriate - having for instance: An example will speak better than me: class Card(object): __cards = {} def __init__(self, number, suit): s

Re: static object

2007-01-03 Thread Gabriel Genellina
At Wednesday 3/1/2007 19:38, meelab wrote: I am looking for a way to create a "static object" or a "static class" - terms might be inappropriate - having for instance: class StaticClass: . . and then staticObject1 = StaticClass() staticObject2 = StaticClass() so that staticObject1 and

Re: code optimization (calc PI)

2007-01-03 Thread Michael
Yes. But it still runns very slowly. If someone is really interested in speed optimization, I can publish my PI-calc code. Maybe for some Python compiler/interpreter hackers... ;-) (There are only 2 while-loops, one within another, and some simple basic calculations. Nothing special.) Stefan

Re: type classobj not defined?

2007-01-03 Thread Gabriel Genellina
At Wednesday 3/1/2007 13:57, Wesley Brooks wrote: >type(b) But the following fails: >type(b) == classobj Traceback (most recent call last): File "", line 1, in ? NameError: name 'classobj' is not defined Do you want to test if you got a `b` class, or just for any class? See inspect.iscla

minidom utf-8 encoding

2007-01-03 Thread fscked
Hi guys/gals. I am trying to write and xml file from data parsed from a csv. I can get everything to work except that I cannot get minidom to do --> ö which needless to say is driving me nuts. Any suggestions? What it ends up doing is just removing the character from the datastream. -- http:/

Dumping objects into spreadsheet readable text (design question)

2007-01-03 Thread _
Hi Pythonistas and Pythonistos, I am doing some fairly complex statistical analyses and trying to display the output in a form readable to technicians not yet enlightened by the wonders of python (ie they still use either Excel, S-PLUS/R, or Matlab only). I need to dump the results into text such

Re: Sorting on multiple values, some ascending, some descending

2007-01-03 Thread dwelden
> The simplest way is to take advantage of sort-stability and do > successive sorts. For example, to sort by a primary key ascending and > a secondary key decending: > >L.sort(key=lambda r: r.secondary, reverse=True) >L.sort(key=lambda r: r.primary) > Excellent! That looks just like what I

Re: Unsubscribing from the list

2007-01-03 Thread Roel Schroeven
Robert Kern schreef: > Dotan Cohen wrote: >> On 03/01/07, Fredrik Lundh <[EMAIL PROTECTED]> wrote: >>> Robert provided *detailed* instructions, which you ignored. I quoted >>> the same instructions in my reply, which you also ignored. the sentence >>> after the one where you stopped reading also

Re: Unsubscribing from the list

2007-01-03 Thread Gabriel Genellina
At Wednesday 3/1/2007 13:21, Dotan Cohen wrote: The first sentance under the heading "Python-list Subscribers" is: The subscribers list is only available to the list administrator. Admin address: Password: As I'm not an admin, I read no further. That page uses the default MailMan administrati

Re: static object

2007-01-03 Thread Russell Owen
In article <[EMAIL PROTECTED]>, meelab <[EMAIL PROTECTED]> wrote: > Dear All, > > I am looking for a way to create a "static object" or a "static class" - > terms might be inappropriate - having for instance: > > class StaticClass: > . > . > > and then > staticObject1 = StaticClass() >

Re: import order or cross import

2007-01-03 Thread Gabriel Genellina
At Wednesday 3/1/2007 07:56, Duncan Booth wrote: However, you really should try to separate scripts from modules otherwise the double use as both __main__ and a named module is going to come back and bite you. I second this. Something with a __main__ can use (import) other modules, but shoud

Re: pythoncom module

2007-01-03 Thread Gabriel Genellina
At Friday 29/12/2006 05:55, Scripter47 wrote: I need a module called "pythoncom" anyone that knows where a can find that module??? It's part of the pywin32 package https://sourceforge.net/project/showfiles.php?group_id=78018 -- Gabriel Genellina Softlab SRL

Re: static object

2007-01-03 Thread Thomas Ploch
meelab schrieb: > Dear All, > > I am looking for a way to create a "static object" or a "static class" - > terms might be inappropriate - having for instance: > > class StaticClass: > . > . > > and then > staticObject1 = StaticClass() > staticObject2 = StaticClass() > > so that staticOb

Re: static object

2007-01-03 Thread bearophileHUGS
That looks like some kind of singleton. Why don't you use a module instead of a class? Another solution is to define your data as class attributes. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

static object

2007-01-03 Thread meelab
Dear All, I am looking for a way to create a "static object" or a "static class" - terms might be inappropriate - having for instance: class StaticClass: . . and then staticObject1 = StaticClass() staticObject2 = StaticClass() so that staticObject1 and staticObject2 refers exactly to th

Re: Iterate through list two items at a time

2007-01-03 Thread J. Clifford Dyer
Gabriel Genellina wrote: > b=iter(a) > for x in b: >y=b.next() >print x,y > So as not to choke on odd-length lists, you could try a = [1,2,3,4,5,6,7] b = iter(a) for x in b: try: y=b.next() except StopIteration: y=None print x,y Substitute in whatever for y

Re: Py_BuildValue or PyList_SetItem()

2007-01-03 Thread Sheldon
Jack Diederich skrev: > On Wed, Jan 03, 2007 at 01:16:38PM -0800, Sheldon wrote: > > I have a function that creates python objects out of C arrays and > > returns them to Python. Below is a working example that I later want to > > expand to return 12 arrays back to Python. The problem is that whe

Re: Unsubscribing from the list

2007-01-03 Thread J. Clifford Dyer
Nice move, using Perl/PHP for that. It's always fun to piss people off by apologizing. ;) Cheers, Cliff Dotan Cohen wrote: > On 03/01/07, Robert Kern <[EMAIL PROTECTED]> wrote: >> He misunderstood you (as I nearly did, too). The way you phrased >> "decided that >> there was no futher interest o

Re: type classobj not defined?

2007-01-03 Thread Denis Kasak
Wesley Brooks wrote: > Dear Users, > > I'm in the process of adding assert statements to a large piece of > code to aid with bug hunting and came across the following issue; > > Using python in a terminal window you can do the following: > >> type(False) == bool > True > > I would like to check

Re: Py_BuildValue or PyList_SetItem()

2007-01-03 Thread Jack Diederich
On Wed, Jan 03, 2007 at 01:16:38PM -0800, Sheldon wrote: > I have a function that creates python objects out of C arrays and > returns them to Python. Below is a working example that I later want to > expand to return 12 arrays back to Python. The problem is that when I > print out the values in Py

Py_BuildValue or PyList_SetItem()

2007-01-03 Thread Sheldon
Hi, I have a function that creates python objects out of C arrays and returns them to Python. Below is a working example that I later want to expand to return 12 arrays back to Python. The problem is that when I print out the values in Python I get undesired reults. See below. Does anyone know wha

Re: When argparse will be in the python standard installation

2007-01-03 Thread Steven Bethard
Martin v. Löwis wrote: > [EMAIL PROTECTED] schrieb: >> I feel argparse has some useful things that optparse doesn't have. But >> I can't find it argparse in python library reference. I'm wondering >> when it will be available in the python standard installation. > > On its own, never. Somebody has

Re: M. Hammonds python panel

2007-01-03 Thread Thomas Heller
[EMAIL PROTECTED] schrieb: > Hello all > > I am a great fan of Mark Hammonds python pannel. But since starship > went down it didn't come up again ...with the link in my favs to > http://starship.python.net/crew/mhammond/mozilla/pythonpanel.xul > still pointing nowhere. > > Maybe Mark is around h

Re: Unsubscribing from the list

2007-01-03 Thread Jan Dries
Dotan Cohen wrote: > On 03/01/07, Robert Kern <[EMAIL PROTECTED]> wrote: >> He misunderstood you (as I nearly did, too). The way you phrased "decided >> that >> there was no futher interest on the page for me" is somewhat ambiguous: it >> can >> seem like it refers to the second time, not the fir

Re: Unsubscribing from the list

2007-01-03 Thread Dotan Cohen
On 03/01/07, Robert Kern <[EMAIL PROTECTED]> wrote: > He misunderstood you (as I nearly did, too). The way you phrased "decided that > there was no futher interest on the page for me" is somewhat ambiguous: it can > seem like it refers to the second time, not the first. > Ah. Sorry. I'm getting be

M. Hammonds python panel

2007-01-03 Thread [EMAIL PROTECTED]
Hello all I am a great fan of Mark Hammonds python pannel. But since starship went down it didn't come up again ...with the link in my favs to http://starship.python.net/crew/mhammond/mozilla/pythonpanel.xul still pointing nowhere. Maybe Mark is around here somewhere... Jürgen -- http://mail.p

Re: Unsubscribing from the list

2007-01-03 Thread Robert Kern
Dotan Cohen wrote: > On 03/01/07, Fredrik Lundh <[EMAIL PROTECTED]> wrote: >> Robert provided *detailed* instructions, which you ignored. I quoted >> the same instructions in my reply, which you also ignored. the sentence >> after the one where you stopped reading also tells you what to do. one

Re: array of class / code optimization

2007-01-03 Thread hg
Neil Cerutti wrote: > On 2007-01-03, Jussi Salmela <[EMAIL PROTECTED]> wrote: >> hg kirjoitti: >>> mm wrote: >>> Yes, it was the (), equivalent to thiks like new() create new object from class xy. > s1.append(Word) s1.append(Word()) But I was looking for a "struct"

Re: Sorting on multiple values, some ascending, some descending

2007-01-03 Thread George Sakkis
dwelden wrote: > I have successfully used the sort lambda construct described in > http://mail.python.org/pipermail/python-list/2006-April/377443.html. > However, how do I take it one step further such that some values can be > sorted ascending and others descending? Easy enough if the sort values

Re: Sorting on multiple values, some ascending, some descending

2007-01-03 Thread Peter Otten
Raymond Hettinger wrote: > dwelden wrote: >> I have successfully used the sort lambda construct described in >> http://mail.python.org/pipermail/python-list/2006-April/377443.html. >> However, how do I take it one step further such that some values can be >> sorted ascending and others descending?

Re: Sorting on multiple values, some ascending, some descending

2007-01-03 Thread bearophileHUGS
Raymond Hettinger: > The simplest way is to take advantage of sort-stability and do > successive sorts. For example, to sort by a primary key ascending and > a secondary key decending: >L.sort(key=lambda r: r.secondary, reverse=True) >L.sort(key=lambda r: r.primary) That's probably the fa

Re: Cannot build 2.5 on FC6 x86

2007-01-03 Thread Martin v. Löwis
Paul Watson schrieb: > ./configure > make > make test > > The result appears to hang after the test_tkl... line. I had to kill > the 'make test' process which terminated it. Any suggestions? There isn't (or shouldn't be) any "test_tkl..." line. What precisely was the line, and how long did you

Re: Why does Python never add itself to the Windows path?

2007-01-03 Thread Martin v. Löwis
vbgunz schrieb: >>> I don't understand what all the fuss is about. Add a single page to the >>> installer and on it, have 3 radio buttons. The choices could be "add to >>> path (recommended)", "add to path with version", "do not add to path >>> (not recommended)". >> Please submit a patch to sf.net

Re: A python library to convert RTF into PDF ?

2007-01-03 Thread robert
[EMAIL PROTECTED] wrote: > Hi, > > Does anyone know a good python library to convert a RTF file into PDF ? > > This should be done automaticaly: I have a web page that takes some > values and inserts them into a RTF template, resulting in an RTF file. > However, I cannot send the output back to t

Re: list/dictionary as case statement ?

2007-01-03 Thread Stef Mientki
Tom Plunket wrote: > Bjoern Schliessmann wrote: > >> Intels aren't RISC, are they? > > Not the ones in PCs. The OP didn't specify the CPU that's being used, > however. > Well it was meant for a small micro-controller, the PIC-14-series, e.g. PIC16F877. I already build a simulator for this devi

Re: A python library to convert RTF into PDF ?

2007-01-03 Thread Felipe Almeida Lessa
On 3 Jan 2007 10:52:02 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I have tried to > convert them to tex using OpenOffice, but the result is ugly as hell. Why not use OO.org to convert DOC to PDF? It does so natively, IIRC. -- Felipe. -- http://mail.python.org/mailman/listinfo/python-

Re: Sorting on multiple values, some ascending, some descending

2007-01-03 Thread Carsten Haese
On Wed, 2007-01-03 at 10:48 -0800, dwelden wrote: > I have successfully used the sort lambda construct described in > http://mail.python.org/pipermail/python-list/2006-April/377443.html. > However, how do I take it one step further such that some values can be > sorted ascending and others descendi

Re: bad marshal data in site.py in fresh 2.5 install win

2007-01-03 Thread TiNo
Removing aliases.pyc solved it. Thank you. 2007/1/3, "Martin v. Löwis" <[EMAIL PROTECTED]>: > TiNo schrieb: > > File "F:\Python25\lib\encodings\__init__.py", line 32, in > >from encodings import aliases > > ValueError: bad marshal data > > > > also removed site.pyc, and run it again, but wi

Re: Sorting on multiple values, some ascending, some descending

2007-01-03 Thread Raymond Hettinger
dwelden wrote: > I have successfully used the sort lambda construct described in > http://mail.python.org/pipermail/python-list/2006-April/377443.html. > However, how do I take it one step further such that some values can be > sorted ascending and others descending? Easy enough if the sort values

Re: Why does Python never add itself to the Windows path?

2007-01-03 Thread vbgunz
> > I don't understand what all the fuss is about. Add a single page to the > > installer and on it, have 3 radio buttons. The choices could be "add to > > path (recommended)", "add to path with version", "do not add to path > > (not recommended)". > > Please submit a patch to sf.net/projects/pytho

Cannot build 2.5 on FC6 x86

2007-01-03 Thread Paul Watson
./configure make make test The result appears to hang after the test_tkl... line. I had to kill the 'make test' process which terminated it. Any suggestions? 280 tests OK. 4 tests failed: test_optparse test_socket test_socket_ssl test_urllib2 35 tests skipped: test_aepack test_al te

Re: When argparse will be in the python standard installation

2007-01-03 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > I feel argparse has some useful things that optparse doesn't have. But > I can't find it argparse in python library reference. I'm wondering > when it will be available in the python standard installation. On its own, never. Somebody has to contribute it to Python, and

Re: Why does Python never add itself to the Windows path?

2007-01-03 Thread Martin v. Löwis
Ben Sizer schrieb: >> Those packages should install .bat files into /scripts on Windows. > > Which still need their location to be be fully qualified, due to > /scripts not being in the path. This is not my experience with Linux > installations of the same packages. Ah, so you not only want the d

Re: When argparse will be in the python standard installation

2007-01-03 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I feel argparse has some useful things that optparse doesn't have. But > I can't find it argparse in python library reference. I'm wondering > when it will be available in the python standard installation. there's already two different option parsing modules in the stan

Re: type classobj not defined?

2007-01-03 Thread Martin v. Löwis
Wesley Brooks schrieb: >> type(b) == classobj > Traceback (most recent call last): > File "", line 1, in ? > NameError: name 'classobj' is not defined > > For the time being I'll use b.__name__ == b to ensure I'm getting the > right class. Is there a reason why the other types such as bool are >

Re: array of class / code optimization

2007-01-03 Thread Bjoern Schliessmann
mm wrote: > But I was looking for a "struct" equivalent like in c/c++. > And/or "union". I can't find it. class Honk(object): pass test = Honk() test.spam = 4 test.eggs = "Yum" Is it this what you're looking for? > Maybe you know a source (URL) "Python for c/c++ programmers" or > things li

Re: code optimization (calc PI)

2007-01-03 Thread Michael
Hmm.. thanks. I did this changes, but without any performance profits. Matimus wrote: > Using the '+' operator for string concatonation can be slow, especially > when done many times in a loop. > > >> pi = pi + str("%04d" % int(e + d/a)) ## this should be fast?! I dont > > > The accepted

Re: code optimization (calc PI)

2007-01-03 Thread Stefan Schwarzer
On 2007-01-03 16:50, mm wrote: > More general, maybe there is a speed optimazation docu out there. At least Alex Martellis "Python in a Nutshell" has a section on optimization. I presented this at the last EuroPython conference: http://sschwarzer.com/download/optimization_europython2006.pdf Stef

Re: list/dictionary as case statement ?

2007-01-03 Thread Bjoern Schliessmann
MRAB wrote: > I think that "PC" referred to the CPU's Program Counter. Argh, thanks. :) > The x86 CPUs if typical Windows PCs aren't RISC but Intel also > manufacture X-Scale (ARM core) processors which are. Okay, sorry for lack of precision. I was referring to x86. Regards, Björn -- BOF

Re: A python library to convert RTF into PDF ?

2007-01-03 Thread leonel . gayard
No, this won't work. First, pdflatex is too slow. Second, my templates are M$-Word doc files, and they cannot be easily converted to tex. I have tried to convert them to tex using OpenOffice, but the result is ugly as hell. I cannot convert the doc files into PDF, because I do not have a library

Sorting on multiple values, some ascending, some descending

2007-01-03 Thread dwelden
I have successfully used the sort lambda construct described in http://mail.python.org/pipermail/python-list/2006-April/377443.html. However, how do I take it one step further such that some values can be sorted ascending and others descending? Easy enough if the sort values are numeric (just negat

Re: list/dictionary as case statement ?

2007-01-03 Thread MRAB
Bjoern Schliessmann wrote: > Tom Plunket wrote: > > > Often (always?) RISC architectures' instruction+operand lengths > > are fixed to the word size of the machine. E.g. the MIPS 3000 and > > 4000 were 32 bits for every instruction, and PC was always a >

Re: A python library to convert RTF into PDF ?

2007-01-03 Thread Tom Plunket
[EMAIL PROTECTED] wrote: > So, what library can I use to convert from RTF to PDF ? GPL / BSD > Libraries are welcome. If you could write to LaTeX files instead, you could then just use pdflatex that comes with all of the LaTeX distributions. -tom! -- -- http://mail.python.org/mailman/listinf

Re: list/dictionary as case statement ?

2007-01-03 Thread Tom Plunket
Bjoern Schliessmann wrote: > Intels aren't RISC, are they? Not the ones in PCs. The OP didn't specify the CPU that's being used, however. -tom! -- -- http://mail.python.org/mailman/listinfo/python-list

Re: Unsubscribing from the list

2007-01-03 Thread Dotan Cohen
On 03/01/07, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Robert provided *detailed* instructions, which you ignored. I quoted > the same instructions in my reply, which you also ignored. the sentence > after the one where you stopped reading also tells you what to do. one > might suspect that yo

Re: array of class / code optimization

2007-01-03 Thread Neil Cerutti
On 2007-01-03, Jussi Salmela <[EMAIL PROTECTED]> wrote: > hg kirjoitti: >> mm wrote: >> >>> Yes, it was the (), equivalent to thiks like new() create new object >>> from class xy. s1.append(Word) >>> s1.append(Word()) >>> >>> But I was looking for a "struct" equivalent like in c/c++. >>> An

Re: Unsubscribing from the list

2007-01-03 Thread Fredrik Lundh
Dotan Cohen wrote: > Actually, I'm a compete idiot Robert provided *detailed* instructions, which you ignored. I quoted the same instructions in my reply, which you also ignored. the sentence after the one where you stopped reading also tells you what to do. one might suspect that you don'

Re: a question on python dict

2007-01-03 Thread Tim Peters
[Tim Peters] >> ... >> Taking my response out of context to begin with doesn't really change >> that I answered the question he asked ;-) [Fredrik Lundh] > welcome to comp.lang.python. > > Thanks for the welcome! It's tough to be a newbie here ;-) -- http://mail.python.org/mailman/listinfo/p

A python library to convert RTF into PDF ?

2007-01-03 Thread leonel . gayard
Hi, Does anyone know a good python library to convert a RTF file into PDF ? This should be done automaticaly: I have a web page that takes some values and inserts them into a RTF template, resulting in an RTF file. However, I cannot send the output back to the user in RTF, it must be sent in PDF

Re: Unsubscribing from the list

2007-01-03 Thread Diez B. Roggisch
Dotan Cohen wrote: > On 03/01/07, Fredrik Lundh <[EMAIL PROTECTED]> wrote: >> if you're unable to follow written instructions, how on earth did you >> manage to subscribe to this list ? >> >> >> > > Actually, I'm a compete idiot and I always post to the mailing list > instead of RTFM or STFW. Wh

Re: Why does Python never add itself to the Windows path?

2007-01-03 Thread Ben Sizer
Martin v. Löwis wrote: > Ben Sizer schrieb: > > Firstly, that solution only works for actual Python scripts; it doesn't > > solve the utility scripts that are often installed to the /scripts > > directory. > > Those packages should install .bat files into /scripts on Windows. Which still need the

Re: code optimization (calc PI)

2007-01-03 Thread Matimus
Using the '+' operator for string concatonation can be slow, especially when done many times in a loop. >pi = pi + str("%04d" % int(e + d/a)) ## this should be fast?! I dont The accepted solution would be to make pi an array and append to the end... pi = [] #create the array (empty) ... ...

Re: Why does Python never add itself to the Windows path?

2007-01-03 Thread Ben Sizer
Chris Lambacher wrote: > On Tue, Jan 02, 2007 at 09:08:41AM -0800, Ben Sizer wrote: > > Chris Lambacher wrote: > > > The python part of the 'python setup.py install' idiom needs to be > > > omitted on > > > Windows, but that does not mean that the solution is to automatically add > > > it > > > t

Re: type classobj not defined?

2007-01-03 Thread Peter Otten
Wesley Brooks wrote: > Dear Users, > > I'm in the process of adding assert statements to a large piece of > code to aid with bug hunting and came across the following issue; > > Using python in a terminal window you can do the following: > >>type(False) == bool > True > > I would like to check

type classobj not defined?

2007-01-03 Thread Wesley Brooks
Dear Users, I'm in the process of adding assert statements to a large piece of code to aid with bug hunting and came across the following issue; Using python in a terminal window you can do the following: >type(False) == bool True I would like to check that an object is a class, here's an examp

Re: Synchronization methodology

2007-01-03 Thread Jeremy Dillworth
Hi Chris, Have you looked at the mutex module? Jeremy -- http://mail.python.org/mailman/listinfo/python-list

Re: function without brackets ?

2007-01-03 Thread Stef Mientki
> Hope this helps, > thanks You all guys, It's perfectly clear to me now ! cheers, Stef -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I add users using Python scripts on a Linux machine

2007-01-03 Thread Sebastian 'lunar' Wiesner
[ Ivan Voras <[EMAIL PROTECTED]> ] > Sebastian 'lunar' Wiesner wrote: >> Carsten Haese <[EMAIL PROTECTED]> typed > >>> I don't think that that has anything to do with Linux or not. The >>> script is not the actual executable, hence its suid bit is >>> irrelevant. >> >> I don't think so. From wha

Re: C/C++, Perl, etc. to Python converter

2007-01-03 Thread Thomas Ploch
Matimus schrieb: > I don't know of a converter, one may exist. I have seen similar > requests though and will give you a similar response to what I have > seen. A converter, if it exists, may be able to produce working code > but _not_ readable code. Python is a language whose strength comes > from

Re: array of class / code optimization

2007-01-03 Thread Jussi Salmela
hg kirjoitti: > mm wrote: > >> Yes, it was the (), equivalent to thiks like new() create new object >> from class xy. >>> s1.append(Word) >> s1.append(Word()) >> >> But I was looking for a "struct" equivalent like in c/c++. >> And/or "union". I can't find it. >> >> Maybe you know a source (URL)

Re: Unsubscribing from the list

2007-01-03 Thread Dotan Cohen
On 03/01/07, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > if you're unable to follow written instructions, how on earth did you manage > to subscribe to this list ? > > > Actually, I'm a compete idiot and I always post to the mailing list instead of RTFM or STFW. What's the name of that big big web

Re: C/C++, Perl, etc. to Python converter

2007-01-03 Thread Richard Charts
mm wrote: > Is there a Perl to Python converter? > Or in general: a XY to Python converter? > > Is see, that Python is much better then Perl anyway. > But for beginners, they whant to konw how is this done with Python etc. > > Sure, there are some docus out there in the internet. But a converter?

When argparse will be in the python standard installation

2007-01-03 Thread [EMAIL PROTECTED]
Hi, I feel argparse has some useful things that optparse doesn't have. But I can't find it argparse in python library reference. I'm wondering when it will be available in the python standard installation. Thanks, Peng -- http://mail.python.org/mailman/listinfo/python-list

Re: C/C++, Perl, etc. to Python converter

2007-01-03 Thread Michael
Yes, I konw what you mean. And thats the right way to do it - for beginners. --But not for someone who allready know programmings things for many years. They ask themself: How can I do this in Python? I can remember, it was that-way with Perl or C or C++ or whatever. So, not only a ververter c

Re: How do I add users using Python scripts on a Linux machine

2007-01-03 Thread Ivan Voras
Sebastian 'lunar' Wiesner wrote: > Carsten Haese <[EMAIL PROTECTED]> typed >> I don't think that that has anything to do with Linux or not. The >> script is not the actual executable, hence its suid bit is irrelevant. > > I don't think so. From what I know, the script is passed as executable > to

  1   2   >