[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Which part of the loop is it going through in this class frame?

When we want to set attributes of `self`, we should do it explicitly.
Not like `this.` in java or C#, `self.` is needed in python.

So, the method

> def print_time(self):
>     time = '6:30'
>     print(self.time)


    1. set a local variable `time` as '6:30'
    2. print `time` which is an attribute of `self`

Two `time` s are different.

It runs line-by-line. `__init__` works at the insantiation.

youta.t at gmail.com