Should I create variables to avoid long lines of code? For example, in the code below, a variable is stream_recordsused only once after setting it.
stream_records = stream.get_latest_records( num_records_to_correlate ).values('value')
stream_values = [float(record['value']) for record in stream_records]
Should I do this instead?
stream_values = [float(record['value']) for record in stream.get_latest_records( num_records_to_correlate ).values('value')]
I am trying to optimize for readability. I would like some opinions on whether to remember many variable names or whether it is more difficult to read long lines of code.
EDIT:
Another interesting opportunity to consider reading (thanks to John Smith Optional):
stream_values = [
float(record['value'])
for record in stream.get_latest_records(
num_records_to_correlate
).values('value')
]
source
share