What variable type is returned from Open()?

Souvik Dutta souvik.viksou at gmail.com
Wed Apr 15 10:09:59 EDT 2020


_io.TextIOWrapper

On Wed, 15 Apr, 2020, 7:30 pm , <dcwhatthe at gmail.com> wrote:

> Hi,
>
>
> As much as possible, I make use of optional type hints.  So if I know a
> function returns an integer, then I use
>
>
> this_number_i : int = GetThisNumber()
>
>
> But there's no 'file' type, so I'm not sure what to use as the type for
> the return value of an Open() function.
>
>
> config_file : file = open(config_file_s, "r")
>
>
> What type of variable should config_file (above) be declared as?
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>


More information about the Python-list mailing list