B
B
bogdan_242016-01-09 23:55:20
Python
bogdan_24, 2016-01-09 23:55:20

Creating a class, how does it work?

I can't understand why 7 is written in date

class SomeClass:
    def __init__(self, a):
        self.date = a
        print("Class created")
        print(self.date)


c = SomeClass(4 | 5 | 6 )

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly, 2016-01-10
@bogdan_24

| is a bitwise OR operation
4 | 5 | 6 == 7 all correct
4 = 100
5 = 101
6 = 110
==> 111 = 7
That is, you create an object "c" of class SomeClass, which is passed the result of this operation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question