[Tutor] MemoryError

Liam Clarke cyresse at gmail.com
Fri Dec 10 14:10:33 CET 2004


Yeah, that's a bit of a brute force approach alright. Mainly all the
(\n)?(=\n)?...

I, personally, intend to have words with a Mr William Gates regarding
just what horrors Frontpage inflicts. I also intend to discuss this
with gmail.google.com, as they parsed the text attachment I sent
myself, added it to the message body, (it seems),unattached it, and
added to the mess a wee bit. My emails always seem strangely
formatted, so yes...

But, that said, I've been shown far more horrific regexe's. I saw one
to parse an ISO-8601 date string (in PHP, I think?)

Made mine look elegant and simple...

But, it was good to learn a wee bit about the re module. Now that I've
actually done this, I probably won't need to do it again, but I'll
know a bit more about the appropriate use of re's.
I still prefer string methods for the simple stuff. 
 It did start off as a way to avoid cutting & pasting, ended up as a
pursuit of knowledge.
Oh well. 

Thanks to all for the assistance.

Regards,

Liam Clarke

On Fri, 10 Dec 2004 07:50:25 -0500, Kent Johnson <kent37 at tds.net> wrote:
> Well, that's a regex only a mother could love. :-) I can see why you were happy to find the
> (?P<text>) form of grouping.
> 
> You should compile textObj and urlObj outside of getVals. You could just pull the four lines that
> create textObj and urlObj outside of the function (into global scope). You just have to compile a
> regex once, then you can use it multiple times. Compiling is relatively slow so pulling it out of
> the loop is an optimization.
> 
> Congrats on getting this working!
> 
> 
> Kent
> 
> Liam Clarke wrote:
> > Hi Kent,
> >
> > Thanks for the help, it worked third time around!
> >
> > The final product is here if you have an interest  -
> > http://www.rafb.net/paste/results/XCYthC70.html
> >
> > But, I think I found a new best friend for this sort of thing -
> > (?P<text>.*?)
> >
> > Being able to label stuff is brilliant.
> >
> > But yeah, thanks for the help, especially that sub method.
> >
> > Regards,
> >
> > Liam Clarke
> _______________________________________________
> 
> 
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 


-- 
'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.


More information about the Tutor mailing list