On 2013-08-29 04:48, Mohsen Pahlevanzadeh wrote: > I'm C++ programmer and unfortunately put semicolon at end of my > statements in python. > > Quesion: > What's really defferences between putting semicolon and don't put?
>From a technical standpoint, nothing (see below). From a "readability on the part of other programmers" standpoint, it's bad practice. So if you're coding for yourself, do whichever makes you happy. If you want to interact with other Python developers and don't want to make them grumpy, remove them. -tkc >>> def with_semis(): ... print 1; ... print 2; ... print 3; ... >>> def without_semis(): ... print 1 ... print 2 ... print 3 ... >>> import dis >>> dis.dis(with_semis) 2 0 LOAD_CONST 1 (1) 3 PRINT_ITEM 4 PRINT_NEWLINE 3 5 LOAD_CONST 2 (2) 8 PRINT_ITEM 9 PRINT_NEWLINE 4 10 LOAD_CONST 3 (3) 13 PRINT_ITEM 14 PRINT_NEWLINE 15 LOAD_CONST 0 (None) 18 RETURN_VALUE >>> dis.dis(without_semis) 2 0 LOAD_CONST 1 (1) 3 PRINT_ITEM 4 PRINT_NEWLINE 3 5 LOAD_CONST 2 (2) 8 PRINT_ITEM 9 PRINT_NEWLINE 4 10 LOAD_CONST 3 (3) 13 PRINT_ITEM 14 PRINT_NEWLINE 15 LOAD_CONST 0 (None) 18 RETURN_VALUE -- http://mail.python.org/mailman/listinfo/python-list