Clickable hyperlinks

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Jan 5 00:30:42 EST 2017


On Thursday 05 January 2017 14:22, Rustom Mody wrote:
> This thread does lead to the question:
> Is the Url type in python less first-class than it could be?
>> In scheme I could point to something like this
> https://docs.racket-lang.org/net/url.html

Those docs say:
"To access the text of a document from the web, first obtain its URL 
AS A STRING..." [emphasis added]
which means that URLs are not a first-class data type in Racket at all. URLs in 
Racket are just strings, exactly the same as in Python.
There is a url struct:
https://docs.racket-lang.org/net/url.html#%28def._%28%28lib._net%2Furl-
structs..rkt%29._url%29%29
but there no first-class syntactic support for them, as ints and lists have in 
Python:
123 # rather than int("123")
[1, 2] # rather than list(1, 2)
> Is there something equivalent in python?

Just like Racket, URLs in Python are not first-class. They start as a string, 
and then you parse them into a tuple:
https://docs.python.org/3/library/urllib.parse.html
https://docs.python.org/2/library/urlparse.html
-- 
Steven
"Ever since I learned about confirmation bias, I've been seeing 
it everywhere." - Jon Ronson


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /