Update: I have filed a bug with highlight.js
None
should be the same colour in the function signature and function body (since it's the same object being referred to), but instead it's plain in the signature and orange in the body.
The code itself:
def my_func(working_list=None):
if working_list is None:
working_list = []
working_list.append("a")
print(working_list)
For comparison, here's what it looks like in Atom, PythonAnywhere, and gedit, which are all using different highlighting schemes:
None
in the function signature isn't enclosed in a<span class="hljs-literal">
(which theNone
in the code is), but is part of a straight text node child of the<span class="hljs-params">
(i.e. the list of parameters). If a string is used in the parameter list, then it's enclosed in a<span class="hljs-string">
. This looks like a parsing issue, which can/should be an issue for highlight.js. That doesn't mean it's not a problem for SO, just that it will need to be fixed in the library.