You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In challenge intermediate/literalstring, function execute_query has a parament accepted Iterable[str],and set default value .... The same pattern is observed in the provided solution.
defexecute_query(sql, parameters: Iterable[str] = ...):
"""No need to implement it"""
This will cause a type check error by pyright
error: Expression of type "ellipsis" cannot be assigned to parameter of type "Iterable[str]"
It seems like I must access type check by changing Iterable[str] to Iterable[str] | EllipsisType , like
fromtypingimportIterable, LiteralStringfromtypesimportEllipsisTypedefexecute_query(sql: LiteralString, parameters: Iterable[str] |EllipsisType= ...):
"""No need to implement it"""
or change ... to () for type check.
fromtypingimportIterable, LiteralStringfromtypesimportEllipsisTypedefexecute_query(sql: LiteralString, parameters: Iterable[str] = ()):
"""No need to implement it"""
I don't think either of the above solutions to be the best way for this issue, but I don't know any better way to use ellipsis for default parameter with type hint.