11
s = 5 // 2
if s == 2:
  print(s)

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?

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

1 Answer 1

-3

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.

7
  • 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. Commented Mar 6, 2011 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
    Commented Mar 6, 2011 at 20:24
  • @sepp2k they do in fact use the default highlighting -- any webby language does. c++ for example, does not. Commented Mar 6, 2011 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
    Commented Mar 6, 2011 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. Commented Mar 7, 2011 at 3:38
  • 4
    Python is a "webby" language!? Commented Apr 4, 2012 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 #. Commented Oct 11, 2012 at 19:24

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