Question: Let's say that I have six different classes and three of them should use the same constant value. What can we do? We either:

* Define as global variable

```
A = 1

class B:
    def __init__(self):
        self.a = A

class C:
    def __init__(self):
        self.a = A

class D:
    def __init__(self):
        self.a = A

```
* Define as class level for 1 class and give it to another class:

```
class B:
    A = 1
    def __init__(self):
        self.b = 2

class C:
    def __init__(self, a):
        self.a = a
        self.b = 3

b = B()
c = B(a=b.A)

```

The second way I just made up and as for me it's dirty and not convenient. Is there any way to avoid using a global variable?

Answer: 
Use class inheritance:

```
class Holder:
    a = 4

class A(Holder):
    pass

print A().a

```
You could use inheritance, using `B` as the base class 

```
class B:
    A = 1
    def __init__(self):
        self.b = 2

class C(B):
    def __init__(self):
        B.__init__(self)
        self.a = B.A
        self.b = 3

b = B()
c = C()
print c.a

```