Newbie: list comprehension troubles..

2009-08-23 Thread mm
Hi, I'm trying to replace this... # this works but there must be a more pythonic way, right? tlist = [] for obj in self.objs: t = obj.intersect(ray) if (t != None): tlist.append((obj,t)) with a list comprehension- can it be done? Wh

Re: csv to excel format problem

2008-10-14 Thread MM
On 14 Ott, 12:03, MM <[EMAIL PROTECTED]> wrote: > Hi to all, > > I'm trying to import a tab separated values file onto Excel with the > following script: > > import csv > from pyExcelerator import * > > w = Workbook() > worksheet = w.add_sheet('sim1&#

[NEWBIE] csv to excel format problem

2008-10-14 Thread MM
Hi to all, I'm trying to import a tab separated values file onto Excel with the following script: import csv from pyExcelerator import * w = Workbook() worksheet = w.add_sheet('sim1') def writeExcelRow(worksheet, lno, columns): style = XFStyle() style.num_format_str = '0.00E+00' cno = 0

Re: code optimization (calc PI)

2007-01-03 Thread mm
lex data structures; and no complex calculations. Diez B. Roggisch wrote: > mm wrote: > > >>(Yes, I konw whats an object is...) >>BTW. I did a translation of a pi callculation programm in C to Python. >>(Do it by your own... ;-) > > > Is that a questio

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

2007-01-03 Thread mm
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? -- http://mail.python

Re: Unsubscribing from the list

2007-01-03 Thread mm
Fredrik Lundh wrote: > if you're unable to follow written instructions, how on earth did you manage > to subscribe to this list ? > > > > > *lol* Just click ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: array of class / code optimization

2007-01-03 Thread mm
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) "Python for c/c++ programmers" or things like that

code optimization (calc PI)

2007-01-03 Thread mm
(Yes, I konw whats an object is...) BTW. I did a translation of a pi callculation programm in C to Python. (Do it by your own... ;-) Calc PI for 800 digs(?). (german: Stellen) -- int a=1,b,c=2800,d,e,f[2801],g;main(){for(;b-c;)f[b++]=a/5; for(;d=0,g=c*2;c-=14,printf("%.4d",e+

array of class

2007-01-02 Thread mm
How can I do a array of class? s1=[] ## this array should hold classes ## class definition class Word: word="" ## empty words... INIT for i in range(100): ## 0..99 s1.append(Wort) s1[0].word="There" s1[1].word="should" s1[2].word="be" s1[3].word="different" s1[4].word="classes" ... b

Re: Question about tuple lengths

2005-12-14 Thread MM Zeeman
Carl J. Van Arsdall wrote: > > From my interpreter prompt: > > >>> tuple = ("blah") > >>> len(tuple) > 4 > >>> tuple2 = ("blah",) > >>> len (tuple2) > 1 > > So why is a tuple containing the string "blah" without the comma of > length four? Is there a good reason for this or is this a bug?

odbc and python

2005-06-02 Thread MM
Are there any other odbc packages other than the win32all and mxodbc ones? The win32all odbc.pyd can't access table structure info like SQLColumns, and mxobdc requires a commercial license which is unjustifiable for this tiny project. Any other OS alternatives for win32?. Thanks. -- http://mai

Re: array of bits?

2005-02-14 Thread MM
Thanks people. List it is. matthew. -- http://mail.python.org/mailman/listinfo/python-list

array of bits?

2005-02-14 Thread MM
Hi, What is the best structure/way to create an array of bits (actually true/false flags) of an arbitrary length ranging from about 20 upto about 500. Speed of access more of an issue than compactness. eg: [0] 0 [1] 0 [2] 1 [3] 0 [4] 1 ... [n] 0 etc. Thanks for your input and advice. matthew. --

win32 extension install hiccup

2005-02-13 Thread MM
Hi, I downloaded the latest win32all build 202 and tried to install under win2000 with Py2.4. Install complains about 'couldn't open py2.4 to run script pywin32-preinstall.py'. I checked the directories and there was no sign of this file (preinstall.py) so I presume this is why it bombed. How d