Type hints - am I doing it right?

Mats Wichmann mats at wichmann.us
Wed Dec 13 11:17:40 EST 2023


On 12/13/23 00:19, Frank Millman via Python-list wrote:

> I have to add 'import configparser' at the top of each of these modules 
> in order to type hint the method.
> 
> This seems verbose. If it is the correct way of doing it I can live with 
> it, but I wondered if there was an easier way.

Think of import as meaning "make this available in my current (module) 
namespace".

The actual import machinery only runs the first time, that is, if it's 
not already present in the sys.modules dict.


More information about the Python-list mailing list