Hi all,
In 1 week, the oTree documentation and sample games will be updated with a new format for defining constants. It will look like this:
class C(BaseConstants):
NAME_IN_URL = 'public_goods_simple'
PLAYERS_PER_GROUP = 3
NUM_ROUNDS = 1
XYZ = 42
# Then to reference a constant, do this:
C.XYZC.NUM_ROUNDS
So basically, the name "Constants" changes just to "C", and constants should be written in all caps.
If you have oTree 5.4 (September 2021) or higher, then it is already compatible with the new format. The existing format will continue to work.
The purpose of the change is to harmonize oTree's code style, especially in preparation for upcoming features. (Also, if you have prior experience in Python, you know that ALL_CAPS is the convention for defining constants.)
If you use oTree Studio, your code will be automatically upgraded to the new format. If you haven't upgraded oTree recently, run "pip3 install -U otree".
Thanks,
Chris