Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Neil Cerutti Newsgroups: comp.lang.python Subject: Re: proposal to allow to set the delimiter in str.format to something other than curly bracket Date: 5 Apr 2011 13:45:53 GMT Organization: Norwich University Lines: 20 Message-ID: <900kohFh35U8@mid.individual.net> References: <902f640f-7540-4309-bb54-a1e71d86bb87@d28g2000yqc.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: individual.net QioO3TsNbZhHZnndYhWSRgFxy9HJ9yNEh2wXMHtoYKdsgT2WyG Cancel-Lock: sha1:m//L3VmP2ks+4/STrDBokUtzKsU= User-Agent: slrn/0.9.9p1/mm/ao (Win32) Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:2649 On 2011-04-04, Alia Khouri wrote: > Nice! I didn't think of that. I guess I could get some > additional performance by taking the re.compile step out of the > function. Thanks for the tip! I recommend "The Pragmatic Programmer," (Hunt, Thomas) ISBN 978-0201616224 and "The Practice of Programming," (Kernighan, Pike) ISBN 978-0201615869 for more practical tips like this one. As a mostly self-taught programmer, both books helped me immensely. If you're a seasoned pro with a CS degree, you might not find them quite as interesting, though. The second book, especially, does not cover issues relating to large scale software development. As for factoring out re.compile, I believe they are cached by the re module, so you would save the cost of retrieving the cached regex, but not the cost of building it. -- Neil Cerutti