Clickable hyperlinks

Deborah Swanson python at deborahswanson.net
Wed Jan 4 19:07:08 EST 2017


D'Arcy Cain wrote, on Wednesday, January 04, 2017 5:03 AM
> 
> Deborah - please trim your quoted text.

Yes, I will. Some lists want to have it all to review in one message,
some want it trimmed to just the lines you are responding to. I was just
waiting to see what this list wants.
 
> On 2017-01-04 04:32 AM, Deborah Swanson wrote:
<snip>
 
> > But we aren't trying to print strings here, the point is to produce 
> > clickable links. I didn't enclose them with quotes because I didn't 
> > see any point in printing plain text when I wanted 
> clickable links. I
> 
> I'm not sure what your links are composed of but mine all look like 
> sequences of characters or "strings."  It sounds like you are 
> trying to 
> make URL a first class type like strings. integers, floats, etc.  I 
> can't think of any language that treats URLs as first class objects. 
> Even HTML needs quotes:
> 
>    <A HREF="http://...">Go here</A>
 
It seemed reasonable that you might be able to print urls, which is why
I tried the experiment with all of Steven's suggested formats. But I was
highly skeptical that any would work without some kind of modifiers to a
bare print statement.

> > actually didn't understand why you thought I should print 
> them, but it
> 
> You want to output them to something.  That often involves 
> printing them 
> to a particular handler.

Yes, that's one of the things I would expect if we could print them.

> > never would have occurred to me that you wanted me to print out a 
> > bunch of silly plain text strings, apparently just for the 
> heck of it.
> 
> Is that really what you got from his message?

Please forgive me, and I hope Steven forgives me too, but I was sick to
death of all the beating on a dead horse (using Python to make clickable
links in a console, any console). I'd taken heart when he first
suggested his print experiment, because it was a plausible approach. But
I lost my temper when he upbraided me in this message for failing to
enclose my strings in quotes, in a most patronizing kind of way, when
printing out plain text was absolutely nowhere on the progress toward a
solution scale. I've been quite impressed with Steven's knowledge and
talent, and after fending off the throng of unseeing naysayers all
afternoon, it was just a little too much. I really should have closed my
email reader hours before I read and replied to this message. Shoulda,
coulda, woulda.
 
<snip>

> I can assure you that FF prints the string at some point.  It 
> may wrap 
> it in HTML tags first but printing is what it does.  Also, 
> the URLs are 
> stored as strings.  SQLite has no URL type.  If it did then it would 
> still store it as a string somewhere.  PostGreSQL would let 
> you create a 
> URL type if you wanted but you would still need to wrap it in quotes 
> (single in this case) when you created the entry.

I have no doubt that some variant of printing is involved. Transporting
urls to the internet is an output process. FF's sqlite implementation
does store urls as a text field in at least 2 tables. I would be
interested in how FF takes those text urls and opens web pages with
them, although I've learned and figured out just today some ways that
Python can also do it. Turns out clickable links were a red herring.

If Steven's original suggestion included anything but a bare print
statement, like the use of a special specifier or linking the print
statement to some module, the use of quoted strings would have at least
been worthy of consideration. But we all know what
print("http://www.wherever.com") would print, and it would be utterly
worthless for the purpose at hand. Trying the print statement without
the quotes was a least a possibility, if there was any awareness in the
print code of urls and what to do with them. That was the whole point of
this fishing expedition, as I saw it. To see if there was any
undocumented or narrowly known-of features in the print code.

<snip>
> In all the messages in this thread I still don't understand what this 
> "teensy advantage" is supposed to be.  Do you want to be able 
> to do this:
> 
>    make_web_link(http://...)
> 
> instead of:
> 
>    make_web_link("http://...")
> 
> -- 
> D'Arcy J.M. Cain
> System Administrator, Vex.Net
> http://www.Vex.Net/ IM:darcy at Vex.Net
> VoIP: sip:darcy at Vex.Net

You probably didn't see my oneliner on the "why do it" part in the swarm
of messages on this thread yesterday. In it I mentioned that the use
would be to open urls in the data I'm working with while I'm debugging
the code that uses them. I want to see what pages they open, without
having to leave my IDE. (Obviously I'd have to open another .py file,
but that would be easier and quicker than the alternatives.) I never
intended my original question to be any more than a frivolous toss out
into the sea, to see if anyone knew an answer. I was flat out astonished
when it blew up into the mini-monster that it did. 

Is make_web_link("http://...") valid python code? That's exactly the
kind of answer I was looking for, and I will try it (or look it up if it
needs something imported) as soon as I send this off. Thank you.

It's possible you caught just the tail end of a hot mess without seeing
all the irrational vitriol and nonsense that led up to this message.
Lucky you.

Deborah



More information about the Python-list mailing list