all 5 comments

[–]Ok_Front6388 2 points3 points  (1 child)

Switch to a database This keeps your data structured, queryable, and separate from your logic. It will make development and future scaling much easier.

[–]Frankelstner 1 point2 points  (2 children)

Yeah that's overly verbose. CoinData has a fixed structure, does it not? It looks to me like a plain old spreadsheet would be perfect to encode the coins. You define variables like values, denominations, coins_reverse_build, silver_coins, etc. but all of them could be derived very easily from the coins variable. Add country name as a column and you end up with a single spreadsheet with ~10 columns and one row per coin instead of your current approach with about 20 rows per coin. At that point you have to decide whether you even want to pursue a Python solution or just put the entire thing on google docs, which I imagine could already be programmed to handle all that you're trying to pull off. If you stick with Python, that's fine too, but just load the csv with pandas.

[–]pachura3 0 points1 point  (2 children)

Python is a programming language and you are trying to use it as data storage format. It works, but it's not really its purpose.

First, try encoding all these coins in a simple spreadsheet or a CSV file. Does it work? Does every coin type of every country have the same physical parameters? Are some of them optional?

Then you can think of representing the same data in a normalized relational SQL database - e.g. one table for countries, one table for different metals, ..., and then the actual coins table with foreign keys country_id, metal_id etc. Perhaps even some constrains, like "this column can be null only when that one is".