Re: Type hints - am I doing it right?

2023-12-13 Thread Thomas Passin via Python-list
On 12/13/2023 11:17 AM, Mats Wichmann via Python-list wrote: 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 w

Re: Type hints - am I doing it right?

2023-12-13 Thread Mats Wichmann via Python-list
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

Re: Type hints - am I doing it right?

2023-12-13 Thread Cameron Simpson via Python-list
On 13Dec2023 09:19, Frank Millman wrote: I am adding type hints to my code base. [...] In the other module I have this - def config_database(db_params): To add a type hint, I now have this - def config_database(db_params: configparser.SectionProxy): To get this to work, I have to

Type hints - am I doing it right?

2023-12-12 Thread Frank Millman via Python-list
Hi all I am adding type hints to my code base. I support three databases - sqlite3, Sql Server, PostgreSQL. The db parameters are kept in an ini file, under the section name 'DbParams'. This is read on program start, using configparser, and passed to a function config_database() in another mo