Python Forum
syntax highlighting - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: syntax highlighting (/thread-29346.html)



syntax highlighting - MaartenRo - Aug-29-2020

Hi,

In my Python shell the numvers in the second line are red highlighted. Why are the numbers in the second line highlighted in red? Does this happen for all numbers?

>>>  class MyClass:
    def DoAdd(self, Value1=0, Value2=0):
        Sum = Value1 + Value2
        print("De som van {0} plus {1} is {2}."
              .format(Value1, Value2, Sum))
        
>>> MyInstance = MyClass()
>>> MyInstance.DoAdd(1, 4)
De som van 1 plus 4 is 5.



RE: syntax highlighting - Larz60+ - Aug-29-2020

I ran it on my Linux Mint system without issue (note, however that I corrected indentation,
and added continuation character to line 4 (probably not necessary))
Perhaps it's an OS 'feature'?
>>> class MyClass:
...     def DoAdd(self, Value1=0, Value2=0):
...         Sum = Value1 + Value2
...         print("De som van {0} plus {1} is {2}." \
...             .format(Value1, Value2, Sum))
... 
>>> MyInstance = MyClass()
>>> MyInstance.DoAdd(1, 4)
De som van 1 plus 4 is 5.
>>>



RE: syntax highlighting - jefsummers - Aug-29-2020

Not red highlighted in Windows 10/64, Python 3.7 or 3.8