Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #2649

Re: proposal to allow to set the delimiter in str.format to something other than curly bracket

From Neil Cerutti <neilc@norwich.edu>
Newsgroups comp.lang.python
Subject Re: proposal to allow to set the delimiter in str.format to something other than curly bracket
Date 2011-04-05 13:45 +0000
Organization Norwich University
Message-ID <900kohFh35U8@mid.individual.net> (permalink)
References <a227e6f7-45ae-4404-973f-b69adf156440@d19g2000yql.googlegroups.com> <mailman.180.1301894287.2990.python-list@python.org> <902f640f-7540-4309-bb54-a1e71d86bb87@d28g2000yqc.googlegroups.com> <mailman.7.1301933897.9059.python-list@python.org> <de6117d4-867a-450d-bf8a-4a9482204cd4@18g2000prd.googlegroups.com>

Show all headers | View raw


On 2011-04-04, Alia Khouri <alia_khouri@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

proposal to allow to set the delimiter in str.format to something other than curly bracket Alia Khouri <alia_khouri@yahoo.com> - 2011-04-03 03:07 -0700
  Re: proposal to allow to set the delimiter in str.format to something other than curly bracket Corey Richardson <kb1pkl@aim.com> - 2011-04-03 06:53 -0400
    Re: proposal to allow to set the delimiter in str.format to something other than curly bracket Alia Khouri <alia_khouri@yahoo.com> - 2011-04-03 05:17 -0700
  Re: proposal to allow to set the delimiter in str.format to something other than curly bracket Terry Reedy <tjreedy@udel.edu> - 2011-04-04 01:17 -0400
    Re: proposal to allow to set the delimiter in str.format to something other than curly bracket Alia Khouri <alia_khouri@yahoo.com> - 2011-04-04 08:42 -0700
      Re: proposal to allow to set the delimiter in str.format to something other than curly bracket Peter Otten <__peter__@web.de> - 2011-04-04 18:18 +0200
        Re: proposal to allow to set the delimiter in str.format to something other than curly bracket Alia Khouri <alia_khouri@yahoo.com> - 2011-04-04 13:45 -0700
          Re: proposal to allow to set the delimiter in str.format to something other than curly bracket Neil Cerutti <neilc@norwich.edu> - 2011-04-05 13:45 +0000
        Re: proposal to allow to set the delimiter in str.format to something other than curly bracket Alia Khouri <alia_khouri@yahoo.com> - 2011-04-04 14:32 -0700

csiph-web