Hi, I have a command-line script in Python to get the correct salutation for a user name in either English or German from a 'salutation server':
$ get_salutation alice Dear Professor Müller $ get_salutation alice -l de Sehr geehrte Frau Professorin Müller The hostname, port, user and password for the 'salutation server' can be given as options on the command-line, but if omitted are read from a configuration file. The program is implemented in two modules without any classes: main.py: ... parse command-line options, read config file ... salutation = my_mailer.salutations.get_salutation(args.user, args.lang, args.host, args.port, args.user, args.secret) salutations.py def get_salutation(uid, lang, host, port, user, secret): ... I have another program that is intended to run as a cron job and send an email to certain users. This is implemented as a number of modules without any classes and will need to use the 'get_salutation' function from the first module. My question: What is the analogue to initialising an object via the constructor for a module? My understanding is that a module is a singleton of the class 'module'. So do I just write a method which reads the config file, or is there some more standardised way which corresponds to instantiating an object via my_object = MyClass() in the case of a class. Cheers, Loris -- This signature is currently under construction. -- https://mail.python.org/mailman/listinfo/python-list