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

From Cecil Westerhof <Cecil@decebal.nl>
Newsgroups comp.lang.python
Subject Re: Is this a good way to work with init and exception
Date 2015-07-19 21:10 +0200
Organization Decebal Computing
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>

Show all headers | 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