MesserLab / SLiM

SLiM is a genetically explicit forward simulation software package for population genetics and evolutionary biology. It is highly flexible, with a built-in scripting language, and has a cross-platform graphical modeling environment called SLiMgui.
https://messerlab.org/slim/
GNU General Public License v3.0
160 stars 30 forks source link

"pretty" option for serialize() #429

Closed jiseonmin closed 6 months ago

jiseonmin commented 6 months ago

Hi Ben,

I am suggesting adding a pretty option to serialize() based on our discussion in https://github.com/kr-colab/spatial_sims_standard/pull/7

Something like:

catn("-------------\n");
    for (k in defaults.allKeys) {
        catn("  " + k + ": " + defaults.getValue(k));
    }
catn("-------------\n");

for a dictionary called defaults

bhaller commented 6 months ago

Will do, will be in SLiM 4.2. :->

bhaller commented 6 months ago

OK, this has been pushed. You can now do:

catn("-------------\n");
catn(defaults.serialize("pretty"));
catn("-------------\n");

to get something similar (although not identical) to what you were printing before. Let me know if there are any problems with this; until it is released in SLiM 4.2, I can make changes to it as needed. :->