I have seen many people use dunder variables(variables wrapped by __) like below.
class NumberService(object):
__small__ = {
'zero': 0,
'one': 1,
'two': 2,
'three': 3,
'four': 4,
}
__magnitude__ = {
'thousand': 1000,
'million': 1000000,
'billion': 1000000000,
}
__ordinals__ = {
'first': 'one',
'second': 'two',
'third': 'three',
'fourth': 'four',
}
__fractions__ = {
'quarter': 'four',
'half': 'two',
'halve': 'two'
}
I am not able to figure out, what they mean exactly in python. I have come across magic methods, Is there any relation between these variables and magic methods?