Reputation: 4927
I am using python 3.7. I have the following line for typing;
from typing import List
ConnectionOptions = List[str]
Does it actually initialise ConnectionOptions
as a list of string or is it merely for typing purposes for static checking?
Reason I ask is usually typing statement uses :
but this one doesn't.
Upvotes: 1
Views: 57
Reputation: 281012
That doesn't create a list of strings. That creates a type alias - ConnectionOptions
can now be used as an annotation meaning "list of strings".
If you want to create an empty list of strings, the way to do that is to use []
, and then not put anything but strings in it.
Upvotes: 3