Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #94163
| Path | csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.060 |
| X-Spam-Evidence | '*H*': 0.88; '*S*': 0.00; 'cc:addr:python-list': 0.09; 'credentials,': 0.09; 'instances.': 0.09; 'okay': 0.09; "(it's": 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:exception': 0.16; 'wrote:': 0.16; 'module,': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'suggested': 0.20; 'fine,': 0.22; 'am,': 0.23; 'references': 0.23; 'sets': 0.23; 'second': 0.24; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'module': 0.25; 'appear': 0.26; 'sense': 0.26; 'parameters': 0.27; 'separate': 0.27; 'message-id:@mail.gmail.com': 0.27; 'issue,': 0.27; 'module.': 0.27; 'then.': 0.27; 'function': 0.28; 'itself,': 0.29; 'way?': 0.29; 'problem': 0.33; 'received:google.com': 0.35; "isn't": 0.35; 'but': 0.36; 'modules': 0.36; 'subject:work': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'doing': 0.38; 'mean': 0.38; 'why': 0.39; 'subject:with': 0.40; 'your': 0.60; 'share': 0.61; "you'll": 0.61; 'success': 0.62; 'different': 0.63; '20,': 0.66; 'state,': 0.66; 'skip:\xe2 10': 0.70; 'jul': 0.72; 'cecil': 0.84; 'chrisa': 0.84; 'subject:good': 0.84; 'westerhof': 0.84; 'subject:this': 0.85; 'absolutely': 0.88; 'to:none': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type:content-transfer-encoding; bh=c9YZFlaVLwC/bLWzmQSDjAugL4KxLRTzt2h2nFMM7uU=; b=Q2xxzJjqyijDTJGzHUnhvD5ToiSmIfMqT84kcae8C6SaTY9qWietPM+OEZmGPQtQ2Y wPC4NHaCwG0r9ZMdyDp/8OV5fDcLxTemnxZNoeHmEb7rL7AtQv6zVKe2NzUHZVwFcW2e fcu7EXQ7p5pLbYPo1z5Ops0JKoJchKHSOjus9oRraot4PTt5dY3FrJY0r6JTprOsj+ds EPSU4+3vJxAxqLuWD1WYOxLBPviMjoY0+34yjUy9NkrqfEJpEHKTC3Ctz6LOU7j5WbMD ACPTbWc6WlI1vpWSl2Lp5D0r0jd58QKs8/H2Q81zTQX1hQhKJf/td486wIyxs/Jmjf4M S5kA== |
| MIME-Version | 1.0 |
| X-Received | by 10.107.132.7 with SMTP id g7mr31060596iod.9.1437340100049; Sun, 19 Jul 2015 14:08:20 -0700 (PDT) |
| In-Reply-To | <87io9gx8tb.fsf@Equus.decebal.nl> |
| References | <87380kzb8b.fsf@Equus.decebal.nl> <mailman.711.1437310769.3674.python-list@python.org> <87r3o4xfhx.fsf@Equus.decebal.nl> <mailman.733.1437329515.3674.python-list@python.org> <87io9gx8tb.fsf@Equus.decebal.nl> |
| Date | Mon, 20 Jul 2015 07:08:19 +1000 |
| Subject | Re: Is this a good way to work with init and exception |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| 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.743.1437340103.3674.python-list@python.org> (permalink) |
| Lines | 22 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1437340103 news.xs4all.nl 2832 [2001:888:2000:d::a6]:34985 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:94163 |
Show key headers only | View raw
On Mon, Jul 20, 2015 at 5:10 AM, Cecil Westerhof <Cecil@decebal.nl> wrote: >> I think it's fine, then. As long as it makes absolutely no sense to >> have two separately-initialized twitter connections, and as long as >> it's okay for two separate modules to both import this and to then >> share state, then what you have is fine. > > I do not see myself doing this, but I like to know ‘everything’. When > I have a program with two different modules that both import this, > they would get in each-others way? How? If two modules import the same module, they get two references to that same module, not two separate module instances. Since your parameters appear only to affect the initialization itself, this is not likely to be a problem (it's not like you'll need to authenticate with two different sets of credentials, for instance), but it will mean that the second one will import an already-initialized module. That's why I suggested the try_init function which would quietly return an immediate success if the module had already been initialized. But if this isn't going to be an issue, then your code's fine. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Is this a good way to work with init and exception Cecil Westerhof <Cecil@decebal.nl> - 2015-07-19 12:35 +0200
Re: Is this a good way to work with init and exception Chris Angelico <rosuav@gmail.com> - 2015-07-19 22:59 +1000
Re: Is this a good way to work with init and exception Cecil Westerhof <Cecil@decebal.nl> - 2015-07-19 18:46 +0200
Re: Is this a good way to work with init and exception Chris Angelico <rosuav@gmail.com> - 2015-07-20 04:11 +1000
Re: Is this a good way to work with init and exception Cecil Westerhof <Cecil@decebal.nl> - 2015-07-19 21:10 +0200
Re: Is this a good way to work with init and exception Chris Angelico <rosuav@gmail.com> - 2015-07-20 07:08 +1000
Re: Is this a good way to work with init and exception Cecil Westerhof <Cecil@decebal.nl> - 2015-07-20 00:19 +0200
Re: Is this a good way to work with init and exception Chris Angelico <rosuav@gmail.com> - 2015-07-20 08:40 +1000
Re: Is this a good way to work with init and exception Cecil Westerhof <Cecil@decebal.nl> - 2015-07-20 01:27 +0200
csiph-web