GaelGil / spotify-playlist-maker

In this project I created a python module that creates spotify playlists from the most popular songs in other spotify playlists
1 stars 0 forks source link

what to return when theres no return #7

Open GaelGil opened 3 years ago

GaelGil commented 3 years ago

I have some functions in my class CreateSpotifyPlaylist. Some functions have no returns for example: def add_tracks_to_playlist(self, playlist_id: str) -> None:. What should the return statement be at the end of the function. Usingreturn and return Nonegives me the issue Useless return at end of function or method (useless-return) when I use pylint. What would be an appropriate return?

camoverride commented 3 years ago

Is there some data inside the function that's manipulated/modified/created and could be returned? For instance, in create_spotify_playlist_from_search you might return a list of songs.

In fact, you might even want to break up this function into two functions: one that does your data manipulation and can be easily tested locally, and another that is a very small function that calls the API and can easily be mocked out.