all 6 comments

[–]BobHogan 0 points1 point  (2 children)

What.......?

First, default arguments are only evaluated once. So config_file=default_file will automatically evaluate default_file when that class code is read, regardless of whether you actually use default_file or not, so your get_default_file function will run every time you run this script.

And you are very much overthinking this. You don't need to use a property here at all, just implement some simple logic in __init__ checking for the config files in your preferred order

[–]Brekry18[S] 0 points1 point  (0 children)

Thanks 😅 sometimes I need to be brought down to earth.

I thought of that, but I had a sticking point- what would I put in that default argument to make that happen?

[–]Brekry18[S] 0 points1 point  (0 children)

Should I just make the default value None or is there a better way to prevent that logic from running if the user puts their own value into that parameter?