Hi everyone,

What exactly is Tuple in the typing module? What does it do?

This is the definition from its website.
https://docs.python.org/3/library/typing.html
"A type alias is defined by assigning the type to the alias"

I have no idea what that means.

Here's the example from the documentation:

from typing import Dict, Tuple, Sequence
ConnectionOptions = Dict[str, str]Address = Tuple[str, int]Server =
Tuple[Address, ConnectionOptions]
def broadcast_message(message: str, servers: Sequence[Server]) -> None:
    ...
# The static type checker will treat the previous type signature as#
being exactly equivalent to this one.def broadcast_message(
        message: str,
        servers: Sequence[Tuple[Tuple[str, int], Dict[str, str]]]) -> None:
    ...


I think this even more confusing. Can someone explain this in simple words?
I don't have a intense computer science background.

Thanks a lot!
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to