proposal to allow to set the delimiter in str.format to something other than curly bracket
Neil Cerutti
neilc at norwich.edu
Tue Apr 5 09:45:53 EDT 2011
On 2011-04-04, Alia Khouri <alia_khouri at yahoo.com> 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
More information about the Python-list
mailing list