KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
From reading PEP-8, I get it that you should put the closing parenthesis on the same line as the last argument in function calls: ShortName.objects.distinct().filter( product__photo__stockitem__isnull=False) Probably, long expressions are best to avoid at all. But if it's undesirable, how would you go about multiple chained method calls? Should the closing paren be on a new line? ShortName.objects.distinct().filter( product__photo__stockitem__isnull=False ).values_list('value', flat=True) What about no-arguments methods? How to write them on multiple lines without referencing the intermediate return values? ShortName.objects.distinct( ).filter().values() # looks ugly Update : There's a duplicate question of How to break a line of chained methods in Python? . The accepted answer suggests a familiar from jQuery style of starting each new line with a dot. The author doesn't provide any reasons or authoritative references, so I'd like to get a confirmation on such style or an alternative.
Tags (comma-separated)
Save Edits
Cancel