Skip to content
This repository has been archived by the owner on Mar 15, 2021. It is now read-only.

Using **kwargs in _connect() of DeviceComms and DccComms #73

Closed
Venkat2811 opened this issue Jan 26, 2017 · 3 comments
Closed

Using **kwargs in _connect() of DeviceComms and DccComms #73

Venkat2811 opened this issue Jan 26, 2017 · 3 comments

Comments

@Venkat2811
Copy link
Contributor

Venkat2811 commented Jan 26, 2017

Data members required for establishing connection in Transport layer are stored in init() method of DeviceComms and DccComms, so that self._connect() can be called. This results in duplication.

Why don't we use **kwargs in abstract _connect() method, so that it can take dynamic arguments instead ?

@Venkat2811
Copy link
Contributor Author

Hi @bfrggit,

Could you please explain why self._connect() should be kept free of external arguments as mentioned in the comment here ?

If it is to facilitate dynamic number of arguments as each transport requires different arguments, why don't we use _connect(**kwargs) instead ?

Adding @KohliDev

@bfrggit
Copy link
Contributor

bfrggit commented Jan 31, 2017

We want to keep the parameters.

At the same time, if we put the parameters in _connect(), it gives the possibility that some one call this method on the same obj multiple times with different parameters, which may cause troubles.

Of course you could always resolve these problems in some ways, whether you decide to use an init() or use _connect() directly. We just decided to use the first manner. In this way it might also be more consistent with other modules and classes.

@Venkat2811
Copy link
Contributor Author

Oh okay. Thanks for explaining.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants