Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Python – Line too long, how can I break this?

I have this line of code:

self.order_total = self.lineitems.aggregate(Sum('lineitem_total'))['lineitem_total__sum'] or 0

It is too long for pep8 validation. I had a look at the docs (https://peps.python.org/pep-0008/#maximum-line-length) but i can’t figure out how best to break it.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Can someone advise me please?

thanks

>Solution :

As I understand you mean Line Breaking. It is too easy

self.order_total = self.lineitems.aggregate(
    Sum('lineitem_total'))['lineitem_total__sum'] or 0
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading