On 03/03/2018 17:38, Eric V. Smith wrote:
I'd just do:
import yourmodule
obj = yourmodule.YourClass()
Or as one line, if that's your thing:
import yourmodule; obj = yourmodule.YourClass()
Which is
More transparent: it's evident what the imported module is used for.
More maintainable: you only need to add or remove one line or two
adjacent lines per instance, instead of two widely separated lines.
(as long as you're happy to defer the imports, of course).
Regards
Rob Cliffe
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/