Answer the question
In order to leave comments, you need to log in
Visual code formatting. Which option is acceptable?
1. So?
self._tg_api.send_photo(chat_id=self._chat_id, caption=_text,
photo=open(_content, 'rb'))
self._tg_api.send_photo(chat_id=self._chat_id,
caption=_text, photo=open(_content, 'rb'))
self._tg_api.send_photo(chat_id=self._chat_id,
caption=_text,
photo=open(_content, 'rb'))
self._tg_api.send_photo(
chat_id=self._chat_id,
caption=_text,
photo=open(_content, 'rb'))
Answer the question
In order to leave comments, you need to log in
All four options are valid. I usually make decisions based on the surrounding code.
For example, if I need to add something unimportant to a large script that is rarely read / edited by anyone, then I see no reason to take up three lines where two can do.
But if this is some key part of the logic and my colleagues will often refer to this place, then for greater readability I will write something that looks more like option 3, and I’ll also make the final bracket on a separate line, on the same level with the first bracket.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question