s = 5 // 2
if s == 2:

As you can see the highlighting system treats Python's floor division operator // as the beginning of a comment. But // is not a comment in Python. Is there any solution? Is it a bug?

  • Jeff edited tags and the effect is no longer visible. But in a real-stack-overflow question it would be python tagged. – Maciej Ziarko Mar 6 '11 at 20:16
  • Another more recent example – smci Jul 5 '11 at 7:28
  • It's clear that even adding the language tag doesn't help the situation in this case. – Omnifarious Oct 11 '12 at 19:27

Was your question correctly tagged ?

We use Google code prettify, and default inference on python because it is a webby language and code blocks tend to be mixed with javascript blocks, html blocks, etcetera.

We're working on an explicit override in cases where this isn't specific enough.

  • 3
    Yes, I was answering to the question tagged python when I noticed it. You should really think about explicit override as Python3 is becoming more and more popular. – Maciej Ziarko Mar 6 '11 at 20:10
  • 3
    I don't see why Python would be more of a webby language than say ruby and perl (or C# and Java for that matter), neither of which use the default highlighting. – sepp2k Mar 6 '11 at 20:24
  • @sepp2k they do in fact use the default highlighting -- any webby language does. c++ for example, does not. – Jeff Atwood Mar 6 '11 at 20:53
  • 1
    I don't want to contradict you, but I actually checked before I said that. If you look for example at this question, you'll notice that the class of the pres is "lang-cs prettyprint", not "default prettyprint". Same for ruby, java and perl. – sepp2k Mar 6 '11 at 21:06
  • @sepp2k if you hold a diamond on the site you can view this setting on the tag, and edit it to whatever default you want. It's possible the diamond mods changed this to something other than default, not understanding the consequences (e.g. all posts with a code block of c# and a code block of XML will now show incorrectly highlighted XML, since it will be forced to lang-cs). All webby languages should be set to default. – Jeff Atwood Mar 7 '11 at 3:38
  • 4
    Python is a "webby" language!? – NullUserException อ_อ Apr 4 '12 at 14:53
  • This is still a problem: stackoverflow.com/questions/12843750/… And it was still wrong after I tagged it as being Python (verified by looking at HTML source). If this is a problem with an upstream package, it would be nice to have a link to a bug #. – Omnifarious Oct 11 '12 at 19:24

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