Is this a good way to work with init and exception

Cecil Westerhof Cecil at
Sun Jul 19 21:10:24 CEST 2015

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

More information about the Python-list mailing list