Oct-30-2017, 05:06 AM
Hi,
I'm self-teaching myself Python using examples and the excellent documentation.
My project is a program that uses a single random seed to generate a made-up "record label", with multiple "artists", each with multiple "albums", each with multiple "tracks", which are generated CSound music code files. It also names the artists, albums, tracks and members of each band, and it generates artwork and album covers.
(If anyone was interested in learning more about this project, PM me. I'd be glad of collaborators!)
I am currently storing the generated data in dictionaries, for example:
label_data = {label_name: "xxx", num_artists: 3, etc etc}
artist_data = {artist_name: "yyy", artist_id: (sequential), num_albums: 5, etc etc}
album_data = {id, name, year, num_tracks, etc etc}
track_data = {id, bpm, tune_pattern, snare_drum_pattern, etc etc}
My question is, would nesting these structures be efficient? The number of objects would vary, due to the randomness.
1 label
1-10 artists
each with 1-10 albums
each with 1-10 tracks
This would mean quite a large number of objects, with 4 levels of nesting.
Would a different data structure be better, for example SQLite? Then I could relate the various objects together using ids and queries.
Grateful for any suggestions.
Best regards,
Matthew Petty
Dubai
I'm self-teaching myself Python using examples and the excellent documentation.
My project is a program that uses a single random seed to generate a made-up "record label", with multiple "artists", each with multiple "albums", each with multiple "tracks", which are generated CSound music code files. It also names the artists, albums, tracks and members of each band, and it generates artwork and album covers.
(If anyone was interested in learning more about this project, PM me. I'd be glad of collaborators!)
I am currently storing the generated data in dictionaries, for example:
label_data = {label_name: "xxx", num_artists: 3, etc etc}
artist_data = {artist_name: "yyy", artist_id: (sequential), num_albums: 5, etc etc}
album_data = {id, name, year, num_tracks, etc etc}
track_data = {id, bpm, tune_pattern, snare_drum_pattern, etc etc}
My question is, would nesting these structures be efficient? The number of objects would vary, due to the randomness.
1 label
1-10 artists
each with 1-10 albums
each with 1-10 tracks
This would mean quite a large number of objects, with 4 levels of nesting.
Would a different data structure be better, for example SQLite? Then I could relate the various objects together using ids and queries.
Grateful for any suggestions.
Best regards,
Matthew Petty
Dubai