What variable type is returned from Open()?
dcwhatthe at gmail.com
dcwhatthe at gmail.com
Wed Apr 15 16:27:12 EDT 2020
On Wednesday, April 15, 2020 at 1:09:26 PM UTC-4, Souvik Dutta wrote:
> Yes that is the type. You can try using a print(type(<your variable>)) to
> verify that.
>
> Souvik flutter dev
>
> On Wed, Apr 15, 2020, 9:45 PM <dcwhatthe> wrote:
>
> > On Wednesday, April 15, 2020 at 10:10:31 AM UTC-4, Souvik Dutta wrote:
> > > _io.TextIOWrapper
> > >
> > > On Wed, 15 Apr, 2020, 7:30 pm , <dcwhatthe> 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
> > > >
> >
> > So you're saying this is a type _io.TextIOWrapper? This type doesn't show
> > up, on the hint listbox (I'm using Wing IDE). So if I type var_file : _io,
> > it doesn't show anything.
> >
> > Maybe I don't understand what you're saying.
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >
Ok, thanks. It's not showing up in the variable type picklist, so I'll just type it in manually, and see what happens, thanks.
More information about the Python-list
mailing list