Rhodri James wrote:
Suppose that we did have some funky mechanism to get the compiler to create objects at compile time

It doesn't necessarily have to be at compile time. It can be at run
time, as long as it only happens once.

So we use "start_date" somewhere, and mutate it because the start date for some purpose was different. Then we use it somewhere else, and it's not the start date we thought it was. This is essentially the mutable default argument gotcha, just writ globally.

I don't think this is as much of a problem as it seems. We often
assign things to globals that are intended to be treated as constants,
with the understanding that it's our responsibility to refrain from
mutating them.

--
Greg
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/NHB5WD4S5ZXUOICHFTFLK5INZPJRZRL2/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to