The correct way to shorten long for statement to a maximum of 79 columns

  • A+
Category:Languages

My question is what's the most conventional way of making the following line of code:

self.steps = [setpoint_and_hold_time.setpoint for setpoint_and_hold_time in program.setpoints_and_hold_times] 

to 79 character columns or less?

  • According to PEP8, the maximum line length should be 79 characters.
  • For long if statements I've used brackets but I'm not sure how I would use them here (if that's the solution).

Also, I assumed this line of code didn't need much background context, if it does please tell me and I'll edit in some classes that explain this line of code.

Thanks.

 


self.steps = [setpoint_and_hold_time.setpoint               for setpoint_and_hold_time               in program.setpoints_and_hold_times] 

/shrug

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: