Re: flatten a list of list

2009-08-17 Thread Tim Cook
On Aug 16, 6:47 am, Terry terry.yin...@gmail.com wrote: Hi, Is there a simple way (the pythonic way) to flatten a list of list? rather than my current solution: new_list=[] for l in list_of_list:     new_list.extend(l) or, new_list=reduce(lambda x,y:x.extend(y), list_of_list) br,

Re: What text editor is everyone using for Python

2009-05-28 Thread Tim Cook
On May 26, 9:07 am, Lacrima lacrima.ma...@gmail.com wrote: I am new to python. And now I am using trial version of Wing IDE. But nobody mentioned it as a favourite editor. So should I buy it when trial is expired or there are better choices? I use nothing but Wing. Their support is great as

Abstract Classes

2009-05-23 Thread Tim Cook
I am implementing a set of specifications that were designed to be OO language neutral. Several classes are specified as being abstract; so therefore there should be no instances of them, correct? However in the classes that are subclasses what is the correct way in Python to implement them? I

Re: IDE Question

2008-10-16 Thread Tim Cook
On Oct 15, 2:19 pm, Steve Phillips [EMAIL PROTECTED] wrote: Hi All, I am just wondering what seems to be the most popular IDE. Well, you have already had many replies. For some context; I am an serious open source advocate. But for productivity I haven't been able to beat WingIDE. Their

Re: Genital Hair Removal

2008-08-01 Thread Tim Cook
On Thu, 2008-07-31 at 20:46 -0700, Paul McGuire wrote: Be careful though, you should not modify a sequence while iterating over it. -- Paul But if I can't remove each hair from the sequence as it's actually removed then how will I ever know when I'm finished? --Tim --

Correct Attribute Assignment Methodology?

2008-07-30 Thread Tim Cook
Say I have these classes: class Parent(object): Parent is abstract a=None def showA(): return self.a class Child(Parent): inherits a and showA from Parent def __init__(self,a,b): self.a=a self.b=b def showAB(): return self.a,self.b class GrandChild(Child):

Re: Stripping parts of a path

2008-07-27 Thread Tim Cook
On Sun, 2008-07-27 at 04:32 +, Tim Roberts wrote: This doesn't do what you think it does. The parameter to rstrip is a set: as long as the last character is in the set 'abcdhiloprs/', it will remove it and check the next one. All of the characters in shop are in that set. Thanks for

Stripping parts of a path

2008-07-26 Thread Tim Cook
Hi All, I just ran into an issue with the rstrip method when using it on path strings. When executing a function I have a need to strip off a portion of the current working directory and add on a path to a log file. Initially this worked great but then I added a branch in SVN which caused the

Unicode confusion

2008-07-14 Thread Tim Cook
Hi All, I'm not clear on how to use the unicode module. I need to be able to use certain characters such as the degree symbol and the mu symbol, i.e.: units = ° if I say units=unicode(°). I

Functional/Best?

2008-07-13 Thread Tim Cook
I guess I can classify my application(s) as more procedural than anything else. But I have a question about the best way to handle something in Python. When given a mapping of keywords, I want to call a function based on a certain keyword found when parsing a text file. The mapping looks like

Re: Malaysia python user group

2008-07-13 Thread Tim Cook
Marcus, You should probably contact the Malaysian Public Sector Open Source Competency Centre (OSCC) in Cyberjaya. http://www.oscc.org.my HTH, Tim On Mon, 2008-07-14 at 10:57 +0800, Marcus.CM wrote: Hi, I am thinking of promoting Python for the local developers here in Malaysia, via

Re: a simple 'for' question

2008-07-09 Thread Tim Cook
On Wed, 2008-07-09 at 00:00 -0400, Ben Keshet wrote: oops, my mistake, actually it didn't work... when I tried: for x in folders: print x # print the current folder filename='Folder/%s/myfile.txt' %x f=open(filename,'r') it says: IOError: [Errno 2] No such file or

Re: start reading from certain line

2008-07-09 Thread Tim Cook
On Wed, 2008-07-09 at 03:30 -0700, antar2 wrote: I am a starter in python and would like to write a program that reads lines starting with a line that contains a certain word. For example the program starts reading the program when a line is encountered that contains 'item 1' The weather

Re: start reading from certain line

2008-07-09 Thread Tim Cook
On Wed, 2008-07-09 at 03:30 -0700, antar2 wrote: I am a starter in python and would like to write a program that reads lines starting with a line that contains a certain word. For example the program starts reading the program when a line is encountered that contains 'item 1' The weather

Re: FOSS projects exhibiting clean/good OOP?

2008-07-09 Thread Tim Cook
On Wed, 2008-07-09 at 07:38 -0700, Phillip B Oldham wrote: I'm wondering whether anyone can offer suggestions on FOSS projects/ apps which exhibit solid OO principles, clean code, good inline documentation, and sound design principles? I'm devoting some time to reviewing other people's code

Re: Hands-on HTML Table Parser/Matrix?

2008-07-06 Thread Tim Cook
There are couple of HTML examples using Pyparsing here: http://pyparsing.wikispaces.com/Examples --Tim On Sun, 2008-07-06 at 14:40 +0200, robert wrote: Often I want to extract some web table contents. Formats are mostly static, simple text numbers in it, other tags to be stripped off.

Instance Names

2008-07-03 Thread Tim Cook
Hi All, I have a need (if at all possible) to create instance names using '[' and ']', i.e. [at]=ClassA0(), [at0001]=ClassB2(), etc. Of course Python tries to unpack a sequence when I do that. Is there anyway to do this? I do have a workaround but it is an ugly, nasty URL mangling thing.

Re: Instance Names

2008-07-03 Thread Tim Cook
On Thu, 2008-07-03 at 14:20 -0500, Larry Bates wrote: I suspect there is some misunderstanding here. Why exactly do you think you need to have your instances named with [] characters in them? I often misunderstand. :-) But, I am implementing specifications in Python that are already

Re: IDE on the level of Eclipse or DEVc++?

2008-06-23 Thread Tim Cook
I highly recommend Wing http://www.wingware.com . There are various licensing levels and even one for open source only developers. The support is AWESOME!. --Tim On Mon, 2008-06-23 at 09:15 -0700, cirfu wrote: is there an IDE for python of the same quality as Eclipse or DEVC++? I am

Python Package Construction

2008-06-19 Thread Tim Cook
Hi All, I would like feedback on the proper/best 'Pythonic' approach. This is a rather subjective question. Where is the trade-off between package name lengths and faithfulness to the specifications? [Discussion follows] I am implementing a set of specifications for healthcare IT for Python

ANN: Open Source Health Information Platform (OSHIP)

2008-05-31 Thread Tim Cook
The wiki announcing the initial source code release of OSHIP is available at: http://www.openehr.org/wiki/display/dev/Python+developer%27s+page Including links to installation and initial startup. There is a news release on Linux Medical News that contains more background and project

Python/ZCA Healthcare Project Announcement

2008-05-21 Thread Tim Cook
that for us. We just need to finish the implementation and some top-level ZCA specific docs. Thank you very much for your kind attention to this project that holds such a deep passion for me. Sincerely, --Tim Cook -- Timothy Cook, MSc Health Informatics Research Development Services LinkedIn