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

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -