Clickable hyperlinks
D'Arcy Cain
darcy at vex.net
Wed Jan 4 08:58:02 EST 2017
On 2017-01-04 08:44 AM, Rodrigo Bistolfi wrote:
> 2017-01-04 7:39 GMT-03:00 Steve D'Aprano <steve+python at pearwood.info>:
>> Aside: you've actually raised a fascinating question. I wonder whether
>> there
>> are any programming languages that understand URLs as native data types, so
>> that *source code* starting with http:// etc is understood in the same way
>> that source code starting with [ is seen as a list or { as a dict?
>
> Some Smalltalk implementations have something that comes close:
>
> st> 'https://python.org' asUrl retrieveContents
But notice that even here the URL has to be defined as a string. To be
a first class object you would need to do something like this:
url = https://python.org/
The only time you would see that is in config files and languages like
shell where everything is a string so no quotes necessary. They are
implied.
> `asUrl` would be a string method returning a URL instance, which also has a
> convenient method `retrieveContents` wrapping an http client. Not hard to
> do with Python, I think this could be an interesting exercise for a learner.
Sure but the issue is, what to do with it. In any case, it's still just
a wrapper around various string methods. You still need to give the
class a string to create the object.
--
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:darcy at Vex.Net
VoIP: sip:darcy at Vex.Net
More information about the Python-list
mailing list