Re: [Tutor] Adding a GUI

2007-09-16 Thread Alan Gauld
"wormwood_3" <[EMAIL PROTECTED]> wrote > I am just starting to learn GUI programming, with wxPython. Good choice. If you will be doing much in wxPython get the book. It makes the whole thing much easier. > The script heretofore was just run at the command line. > Would it make sense to add an

[Tutor] how to match regular expression from right to left

2007-09-16 Thread 王超
hi, I want to match the regular expression from right to left, such as: TAG_pattern = re.compile(r"(us::.*) .*(1002|1003).*$") TAG_pattern.search(line) Does the search method support this? Thanks, Daniel ___ Tutor maillist - Tutor@python.org http://

Re: [Tutor] how to match regular expression from right to left

2007-09-16 Thread Tom Tucker
Yep, looks like it. >>> line = 'us::blah blah2 1002 blah3' >>> import re >>> TAG_pattern = re.compile(r"(us::.*) .*(1002|1003).*$") >>> if TAG_pattern.search(line): ... print 'we have a match' ... we have a match >>> >>> line2 ='us::blah blah2 1001 blah3' >>> if TAG_pattern.search(line2): ...

Re: [Tutor] how to match regular expression from right to left

2007-09-16 Thread 王超
yes, but I mean if I have the line like this: line = """38166 us::Video_Cat::Other; us::Video_Cat::Today Show; us::VC_Supplier::bc; 1002::ms://bc.wd.net/a275/video/tdy_is.asf; 1003::ms://bc.wd.net/a275/video/tdy_is_.fl;""" I want to get the part "us::MSNVideo_Cat::Other; us::MSNVideo_Cat::Today S

Re: [Tutor] how to match regular expression from right to left

2007-09-16 Thread Kent Johnson
王超 wrote: > hi, > > I want to match the regular expression from right to left, such as: > > TAG_pattern = re.compile(r"(us::.*) .*(1002|1003).*$") > TAG_pattern.search(line) > > Does the search method support this? What do you mean match from right to left? If you mean, match an re that is anc

Re: [Tutor] Adding a GUI

2007-09-16 Thread Michael Langford
Wormwood, an easier way to create a crossplatform GUI than raw wxPython is to use pythoncard, which is a library that is on top of wxPython that is there to make it easier to use and to make it easier to layout GUI screens/dialogs. I've found its a much faster "whiteboard to running software time"

Re: [Tutor] how to match regular expression from right to left

2007-09-16 Thread Kent Johnson
王超 wrote: > The number of iterms - (us::.*?) - varies. > > When I use re.findall with (us::*?), only several 'us::' are extracted. I don't understand what is going wrong now. Please show the code, the data, and tell us what you get and what you want to get. Here is an example: Without a group y

Re: [Tutor] how to match regular expression from right to left

2007-09-16 Thread 王超
The number of iterms - (us::.*?) - varies. When I use re.findall with (us::*?), only several 'us::' are extracted. Daniel On 9/16/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > > 王超 wrote: > > yes, but I mean if I have the line like this: > > > > line = """38166 us::Video_Cat::Other; us::Video_Ca

Re: [Tutor] how to match regular expression from right to left

2007-09-16 Thread 王超
kent: Thank you. I got the right results with re.findall('(us::.*?);', line). I used these codes before: >>> TAG_pattern = re.compile(r"(us::.*?)") >>> TAG_pattern.findall(line) and got the unwanted results 'us::' Tom: Thank you. But the number of 'us::' terms varies, and kent's solution works w

Re: [Tutor] how to match regular expression from right to left

2007-09-16 Thread Kent Johnson
王超 wrote: > kent: > Thank you. I got the right results with re.findall('(us::.*?);', line). > > I used these codes before: > >>> TAG_pattern = re.compile(r"(us::.*?)") > >>> TAG_pattern.findall(line) > and got the unwanted results 'us::' That is because .*? will match the empty string. You hav

[Tutor] Adding a GUI

2007-09-16 Thread wormwood_3
>> First of all Sam, thanks for your help with the fileinput() problem I >> was having! =) Sure thing:-) Sorry I could not actually solve it! I am still have a hard time getting my mind around the line.strip(), then printing based on a condition loop. Not sure why... The excerpt from Lutz' boo

Re: [Tutor] Adding a GUI

2007-09-16 Thread wormwood_3
Hi, >> Wormwood, an easier way to create a crossplatform GUI than raw wxPython is >> to use pythoncard, which is a library that is on top of wxPython that is >> there to make it easier to use and to make it easier to >> layout GUI screens/dialogs. I have heard some good things about pythoncar

Re: [Tutor] referencing vars()

2007-09-16 Thread Terry Carroll
On Sat, 15 Sep 2007, John wrote: > I'm trying to do the above, but of course get an error because vardict is > only referencing vars(), thus changes size... also, I tried > vardict=[vars()], but this fails as well?? How about import copy vardict=copy.copy(vars()) That way, you've made a copy

[Tutor] remove instances from a list

2007-09-16 Thread Ara Kooser
Hello all, On my continuing quest to grapple with OO programming Kent showed me that I could call instances and store them in a list like: yeasts = [Yeast("Red_1","Red","ade","lys"),Yeast("Yellow_1","Yellow","lys","ade"), Yeast("Red_2","Red","ade","lys"),Yeast("Yellow_2","Yellow","l

Re: [Tutor] remove instances from a list

2007-09-16 Thread John Fouhy
On 17/09/2007, Ara Kooser <[EMAIL PROTECTED]> wrote: > Give certain conditions I want the yeast cell to die. Kent suggested I > use something this: > yeasts = [yeast for yeast in yeasts if yeast.isAlive()] to clear out > dead yeast. [...] > class Yeast: [...] > def isAlive(self): > if

Re: [Tutor] remove instances from a list

2007-09-16 Thread Kent Johnson
Ara Kooser wrote: > Hello all, > >On my continuing quest to grapple with OO programming Kent showed > me that I could call instances and store them in a list like: > yeasts = > [Yeast("Red_1","Red","ade","lys"),Yeast("Yellow_1","Yellow","lys","ade"), > > Yeast("Red_2","Red","ade","

Re: [Tutor] remove instances from a list

2007-09-16 Thread Ian Witham
On 9/17/07, Ara Kooser <[EMAIL PROTECTED]> wrote: > > Hello all, > >On my continuing quest to grapple with OO programming Kent showed > me that I could call instances and store them in a list like: > yeasts = > [Yeast("Red_1","Red","ade","lys"),Yeast("Yellow_1","Yellow","lys","ade"), > >

[Tutor] performance

2007-09-16 Thread Jeff Peery
Hello, I've got a quick question regarding performance of lists. I am taking measurements and building up a list of objects for each measurement. the class I created for the objects has attributes of time, numerical value, person's name who collected the sample etc. I also have functions with

Re: [Tutor] performance

2007-09-16 Thread Carlos Daniel Ruvalcaba Valenzuela
Don't worry too much for the accessors, I'm pretty sure it won't degrade your performance in a noticeable way, you objects will only grow a tiny bit by adding a function to the class, all objects share the same in memory code and each one has it's own data, the function for the object is just a ref