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


Groups > comp.lang.python > #86648

Re: suggestions for functional style (singleton pattern?)

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.python
Subject Re: suggestions for functional style (singleton pattern?)
Date Sat, 28 Feb 2015 22:23:02 -0800
Organization A noiseless patient Spider
Lines 7
Message-ID <874mq58ce1.fsf@jester.gateway.pace.com> (permalink)
References <WXrIw.14066$uP4.9692@fx20.iad>
Mime-Version 1.0
Content-Type text/plain
Injection-Info mx02.eternal-september.org; posting-host="c694756f1077760bb5296aae16c74092"; logging-data="25281"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX195MAnI/4PgjyWiuSg5ZDC6"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Cancel-Lock sha1:TBUJMsVT2VBU51haSUHDx4pCebE= sha1:JEGRxeJJMjt6meCJfWgqcZKVbvY=
Xref csiph.com comp.lang.python:86648

Show key headers only | View raw


yves@zioup.com writes:
> Are there better ways to address this? Any suggestion on this style?

I guess I don't completely understand the question.  But one way to do a
singleton in python is put the initialization code into a separate
module.  Then the first time you import the module, the code runs, but
it doesn't re-run on subsequent imports.  

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


Thread

suggestions for functional style (singleton pattern?) yves@zioup.com - 2015-02-28 16:12 -0700
  Re: suggestions for functional style (singleton pattern?) Michael Torrie <torriem@gmail.com> - 2015-02-28 19:19 -0700
    Re: suggestions for functional style (singleton pattern?) yves@zioup.com - 2015-02-28 21:11 -0700
      Re: suggestions for functional style (singleton pattern?) Michael Torrie <torriem@gmail.com> - 2015-02-28 22:14 -0700
  Re: suggestions for functional style (singleton pattern?) Mario Figueiredo <marfig@gmail.com> - 2015-03-01 04:45 +0100
    Re: suggestions for functional style (singleton pattern?) yves@zioup.com - 2015-02-28 21:29 -0700
      Re: suggestions for functional style (singleton pattern?) Michael Torrie <torriem@gmail.com> - 2015-02-28 22:05 -0700
        Re: suggestions for functional style (singleton pattern?) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-02 02:55 +1100
        Re: suggestions for functional style (singleton pattern?) Fabien <fabien.maussion@gmail.com> - 2015-03-02 11:19 +0100
          Re: suggestions for functional style (singleton pattern?) Mario Figueiredo <marfig@gmail.com> - 2015-03-02 11:31 +0100
          Re: suggestions for functional style (singleton pattern?) Michael Torrie <torriem@gmail.com> - 2015-03-02 08:59 -0700
          Re: suggestions for functional style (singleton pattern?) Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-02 09:51 -0700
      Re: suggestions for functional style (singleton pattern?) Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-03-01 19:00 +1300
    Re: suggestions for functional style (singleton pattern?) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-02 02:04 +1100
      Re: suggestions for functional style (singleton pattern?) Mario Figueiredo <marfig@gmail.com> - 2015-03-01 19:20 +0100
  Re: suggestions for functional style (singleton pattern?) Paul Rubin <no.email@nospam.invalid> - 2015-02-28 22:23 -0800

csiph-web