I am trying to write Python 2.7 cod that is easier to scale by removing argument order while providing default values in the case that requirements change. Here is my code:
# Class:
class Mailer(object):
def __init__(self, **args):
self.subject=args.get('subject', None)
self.mailing_list=args.get('mailing_list', None)
self.from_address=args.get('from_address', None)
self.password=args.get('password', None)
self.sector=args.get('sector', "There is a problem with the HTML")
# call:
mailer=Mailer(
subject="Subject goes here",
password="password",
mailing_list=("email@email.com", "email@email.com","email@email.com"),
mailing_list=("email@email.com", "email@email.com"),
from_address="email@email.com",
sector=Sector()
)
I'm still new to the language so if there is a better way to achieve this, I'd really like to know. Thanks in advance.