Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
syntax highlighting
#1
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.
Reply
#2
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.
>>>
Reply
#3
Not red highlighted in Windows 10/64, Python 3.7 or 3.8
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Highlighting in IDLE Stumpy_L 9 7,747 Feb-07-2018, 04:03 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020