Module import best practice

Rich Shepard rshepard at appl-ecosys.com
Thu Mar 26 17:12:33 EDT 2020


On Fri, 27 Mar 2020, DL Neil via Python-list wrote:

> My personal approach is to follow 'the Zen of Python' and prefer
> "explicit" over "implicit". (it helps beginners, as well as us old-fogies
> whose minds cannot retain things for very long)

DL,

That was my original approach.

> I see little point in importing 'stuff' that's not used.

Agree.

> Hoping this non-answer helps, by leaving you with reading topics which
> will realise advice for the concerns you had/hadn't noted to-date.

Actually, it's a very good answer.

I'm not a professional coder. I'm an environmental consultant and I use a
variety of tools depending on the project's requirements. Most every day I'm
in emacs. use LyX for almost all writing, R and GRASS for data analyses, SQL
for database work, awk, sed, shell scripts, and python as required. This
means I'm constantly relearning what I forgot since the last time. This has
worked well for me for almost 30 years so I'm not complaining.

But now I am adding GUIs and other Real Application(TM) bits to postgres
applications I run from the command line for my own use so I can give these
tools to others who might benefit from them. The last database-backend
application I wrote in python2 and wxPython was more than a decade ago. Now
I'm working exclusively with Python3 and learning tkinter. I've much to
learn. ;-)

Thanks for the complete explanation and I hope your dinner didn't burn on
the grill.

Regards,

Rich



More information about the Python-list mailing list