why is str() the same as repr()?
wbolster opened this issue · 3 comments
wbolster commented
>>> url = URL.from_text('https://example.org/api/v2')
>>> str(url)
"URL.from_text('https://example.org/api/v2')"
>>> repr(url)
"URL.from_text('https://example.org/api/v2')"
why is str() not just the url?
https://example.org/api/v2
the requests library "stringifies" urls (by design). in practice that means that for instance furl instances can be passed directly. this is not possible with hyperlink:
>>> from hyperlink import URL
>>> import requests
>>> url = URL.from_text('https://example.org/api/v2')
>>> requests.get(url)
[...]
InvalidSchema: No connection adapters were found for 'URL.from_text('https://example.org/api/v2')'mahmoud commented
That's a good point, I don't think I'd be opposed to this change. Maybe @Lukasa has an opinion?
mahmoud commented
wbolster commented
awesome, keep up the good work.