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


Groups > comp.lang.python > #94153

Re: Is this a good way to work with init and exception

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Cecil Westerhof <Cecil@decebal.nl>
Newsgroups comp.lang.python
Subject Re: Is this a good way to work with init and exception
Date Sun, 19 Jul 2015 21:10:24 +0200
Organization Decebal Computing
Lines 37
Message-ID <87io9gx8tb.fsf@Equus.decebal.nl> (permalink)
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>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
Injection-Info mx02.eternal-september.org; posting-host="528adfd6ad074c92fdc6a7f8fb9e23d8"; logging-data="5904"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18n0x8sjyEnWK91AUeRDyQZtUPkBiiOooc="
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Cancel-Lock sha1:se5JHcFJFH5es+NnZbhUz+OxFgE= sha1:n3DtOiH5+6yhB94HIYKUHavWAUc=
X-Homepage http://www.decebal.nl/
Xref csiph.com comp.lang.python:94153

Show key headers only | View raw


On Sunday 19 Jul 2015 20:11 CEST, Chris Angelico wrote:

>>> Parameterized imports aren't possible, correct. What I'd look at
>>> here is a more explicit instantiation. Something like:
>>>
>>> import twitterDecebal
>>> twitter = twitterDecebal.twitterDecebal(5, 60)
>>
>> I worked with default values, because I thought that would be a
>> good idea. I should remove the default values?
>
> No no, the default values are good. I just gave an example that
> didn't use them, as that's where you actually need the call. If
> you're always going to use the defaults, well, there's not a lot of
> point having the function. But if you often use the defaults (or one
> of them), and occasionally override it, then what you have is good
> design.

In my case I think the defaults are good. (But I do not know how I
will use the function in the future. ;-) ) But I want to share it on
GitHub and it would be possible that for someone else my defaults are
not correct and then it is nice when they can be overridden.


> 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?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

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


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