Sometimes when coding, I want "special sorts of strings" and "special sorts of integers" for documentation.
For example you might have.
def make_url(name:str) -> URL:
where URL
is really a string. In some languages like C you can use a typedef for this, and in python you could do something like.
URL = str
Is there a correct way to do this? You can do stuff in a very programmatic way, and have:
class URL(str):
pass
or even
class URL:
def __init__(self, url):
self.url
But both of these feel excessive such that for a lot of use cases they aren't really worth the overhead.