1

I noticed a bug. I was visiting this question. I saw this comment containing a link to a Stack Overflow question. I hovered my mouse over the link in the comment, the mouse-over text appeared.


why is python showing valueerror could not convert string to float?


The text is not formatted (no special characters included, title is lowercase).

I expected this:

The same text with ValueError capitalized, quotation marks around the error message, and a question mark at the end.

7
  • 4
    That title is generated from the link URL itself. Getting the true title would probably require at least one AJAX request. Commented Nov 5, 2018 at 9:57
  • @Xufox the title is not generated by your browser, it's put in the title attribute by Stack Overflow. They could easily put the formatted title in there too.
    – user247702
    Commented Nov 5, 2018 at 12:16
  • @Stijn I never said the title attribute was generated by the browser. The title attribute is generated (obviously by Stack Exchange) by replacing each - from why-is-python-showing-valueerror-could-not-convert-string-to-float (as found in the URL) by a space. Getting the actual title likely would involve AJAX requests. Even if it wouldn’t, this change is probably not worth it. If this is going to be fixed, at least the actual link text should contain the question title as well. Commented Nov 5, 2018 at 12:21
  • Why would it involve AJAX requests at all? Their renderer backend now fills the title attribute with what you describe, it could instead pull the proper title from the database (or wherever it comes from).
    – user247702
    Commented Nov 5, 2018 at 12:22
  • Would certainly not require an AJAX request. It would require another DB hit per link per comment. Not saying that this is right or wrong, but the data has to come from somewhere.
    – yivi
    Commented Nov 5, 2018 at 12:24
  • I would retag this as a feature-request, since this is the expected behaviour and not a bug.
    – yivi
    Commented Nov 5, 2018 at 12:25
  • 5
    The beauty of how it currently works is that you can improve on the existing title. E.g.: stackoverflow.com/questions/13259728/…
    – yivi
    Commented Nov 5, 2018 at 12:29

1 Answer 1

1

Unlike posts, there's no pre-rendered version of comments stored in the database - they're converted into HTML every time the page is requested. This means that we can't retrieve the title of a linked question without parsing it out and issuing another query for every link (or, I suppose, one aggregate query for the entire set of comments if we're very careful) - no matter how you slice it, that's slower than not querying for titles.

So the title-tip is generated purely from the "slug" - that bit of text after the question ID in the URL itself. And the slug doesn't contain any information about which bits were capitalized, where there was punctuation, etc.

See also: Tooltip for question links in comments showing sanitized title

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .