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

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 <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 5 Apr 2011 13:45:53 GMT
Organization Norwich University
Lines 20
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>
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

Show key headers only | 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 | Unroll thread


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