What is the difference with Python statements ending in;

What is the difference with Python statements ending with; and is it not so?

+4
source share
2 answers

There is no difference. Python completes a line of code at the end of a logical line or when encountered;

The only advantage of using it ;is that you can stack multiple logical lines in one physical line. For example (in python3):

import sys

for i in range(10):
    print(i, end=' '); sys.stdout.flush()

However, this is a terrible coding style, so never do it

+8
source

, . , , , .

+2

Source: https://habr.com/ru/post/1657013/


All Articles