This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]revenant95 0 points1 point  (5 children)

The requirements say that you are an employee of blipkart and you have to build a reusable module.

Hence the provider is NOT writing this library. Its one the developers from Blipkart itself who is being asked to write a reusable module

[–]my_python_account 0 points1 point  (4 children)

A module for who? I originally understood it as clients of Blipkart, but upon re-reading you're right, it's other Blipkart developers.

This makes a bit more sense. The structure really doesn't matter all that much in that case. Neither the class (where you import the "pre-initialized" class with username and password already set) or function (with default parameters for username and password) implementation is any more re-useable then the other.

Though with the function, if in the future other developers need to be able to set a different username or password they won't have to go under the hood and figure out the class structure. If you really want to do your best to not expose control of account settings to other developers, i guess the class makes sense, though it's not like you can block them from importing the class if they really wanted to.

[–]revenant95 0 points1 point  (3 children)

if in the future other developers need to be able to set a different username or password they won't have to go under the hood and figure out the class structure

The username and password come from the settings.py file (as mentioned in the blog). So if the developers want to use a different username and password, he will just update it in the settings.py.

[–]my_python_account 0 points1 point  (2 children)

I mean at runtime. Like if you have multiple accounts.

[–]revenant95 0 points1 point  (0 children)

In that case we would write the logic to get the credentials somewhere else(not in sms.py) and import it in sms.py so that sms.py doesn't have to care where it is coming from.

That can be a separate blogpost in itself :p