Attribute 'track' defined outside __init__
16
17 first_track = result.tracks[0] # Grab the first track from the results.
18 base64 = first_track.track # Extract the base64 string from the track.
19 self.track = base64 # We'll store this for later, as it allows us to save making network requests20 # if this track is re-used (e.g. repeat).
21
22 return base64
Description
Defining an instance attribute outside __init__
affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__
method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None
in the init then call the sub-initialization methods.