How to correctly break a long line in Python? -


how go breaking following line? pep8 guideline doesn't make clear me.

confirmation_message = _('order_created: %(property_1)s - %(property_2)s - %(property_3)s - %(property_4)s')  % {'property_1': order.lorem, 'property_2': order.ipsum, 'property_4': order.dolor, 'property_5': order.sit} 

one typically like:

confirmation_message = _(     'order_created: %(property_1)s - '     '%(property_2)s - %(property_3)s - %(property_4)s') % {         'property_1': order.lorem,         'property_2': order.ipsum,         'property_3': order.ipsum,         'property_4': order.dolor,         'property_5': order.sit     } 

this takes advantage of fact adjacent strings ('like ' 'this') concatenated shorten long line of text; else split on commas.


Comments