syntax - How to split long python expression in python -
this question has answer here:
how should format following code per pep-8 guidelines? don't see examples this. or there no guideline this? questions on ask splitting long conditionals or line continuation.
def send_notification(version, device_type): reg_ids = udr.objects.filter(device_type=device_type).values_list('id', 'device_type', 'registration_id') if not reg_ids: logger.debug("no notifications send")
should formatted as:
def send_notification(version, device_type): reg_ids = udr.objects.filter( device_type=device_type).values_list('id', 'device_type', 'registration_id') if not reg_ids: logger.debug("no notifications send")
or this:
def send_notification(version, device_type): reg_ids = udr.objects.filter(device_type=device_type)\ .values_list('id', 'device_type', 'registration_id') if not reg_ids: logger.debug("no notifications send")
or else altogether?
you can take guidance form following url https://www.python.org/dev/peps/pep-0008/#code-lay-out
just give try , ask if don't understand.
Comments
Post a Comment