Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #86646
| Path | csiph.com!usenet.pasdenom.info!news.franciliens.net!news.muarf.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <torriem+gmail@torriefamily.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.011 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'intermediate': 0.07; 'suppose': 0.07; 'variables': 0.07; 'explanation': 0.09; 'instance.': 0.09; "wouldn't": 0.14; 'bind': 0.16; 'dict': 0.16; 'for,': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'repl': 0.16; 'singleton': 0.16; 'subject:?)': 0.16; 'wrote:': 0.18; '(not': 0.18; 'do.': 0.18; 'trying': 0.19; 'code,': 0.22; 'programming': 0.22; 'header:User-Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'function': 0.29; 'appear': 0.29; 'michael': 0.29; "i'm": 0.30; 'code': 0.31; 'calculated': 0.31; 'object.': 0.31; 'values.': 0.31; 'class': 0.32; 'style': 0.33; "i'd": 0.34; 'could': 0.34; 'subject: (': 0.35; 'created': 0.35; 'problem.': 0.35; 'but': 0.35; 'there': 0.35; 'doing': 0.36; 'should': 0.36; 'behind': 0.37; 'list': 0.37; 'easily': 0.37; 'implement': 0.38; 'message-id:@gmail.com': 0.38; 'problems': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'rather': 0.38; 'does': 0.39; 'functional': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'read': 0.60; 'chain': 0.60; 'matter': 0.61; 'kind': 0.63; 'more': 0.64; 'charset:windows-1252': 0.65; 'to,': 0.72; 'calculations': 0.84; 'employ': 0.93 |
| X-Virus-Scanned | amavisd-new at torriefamily.org |
| Date | Sat, 28 Feb 2015 22:14:11 -0700 |
| From | Michael Torrie <torriem@gmail.com> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: suggestions for functional style (singleton pattern?) |
| References | <WXrIw.14066$uP4.9692@fx20.iad> <mailman.0.1425176390.29956.python-list@python.org> <ojwIw.1477738$W25.174147@fx02.iad> |
| In-Reply-To | <ojwIw.1477738$W25.174147@fx02.iad> |
| Content-Type | text/plain; charset=windows-1252 |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.19 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3.1425186857.29956.python-list@python.org> (permalink) |
| Lines | 30 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1425186857 news.xs4all.nl 2912 [2001:888:2000:d::a6]:42520 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:86646 |
Show key headers only | View raw
On 02/28/2015 09:11 PM, yves@zioup.com wrote: > On 2015-02-28 19:19, Michael Torrie wrote: >> You say you are trying to use a singleton pattern, but your code does >> not appear to implement a singleton. From what I can read of your code, > > I call it a singletone because I only every create one object. > > I am not trying to use a singleton, I'm trying to avoid issues created by the > alternative ways of doing this (not having access to the variables in the repl > etc...). > > There are type of problems where I don't want to bind functions to data. > > By the way, I have just added some more explanation in the code, > trying to clarify the problem. I suppose it's just a matter of style but I'd just have my utility function return a dict of all the calculated values, rather than store them in a utility class instance. Then you wouldn't need an intermediate object to hold state temporarily. The idea behind functional programming in part is you can chain things together easily should you need to, which your intermediate object cannot do. But I do see kind of the pattern you are trying to employ here; I just don't understand why it's required or what you'd use it for, given that a function could just do all the calculations and return a list or dict of all calculated the values.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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