On Fri, May 28, 2021 at 7:04 AM Christopher Barker <python...@gmail.com> wrote:
>
> My concern about thread safety is about how easy it would be to make it 
> thread unsafe accidentally.
>
> Sure, global is not thread safe, but it is well known that use of global is, 
> to newbies, “bad”, and to more experienced programmers, “to be used with 
> caution, understanding the risks”.
>
> But particularly if static provides a performance boost, people will be very 
> tempted to use it without considering the implications.
>
> If people want a high performance local constant— that sounds something like 
> the constant proposal the OP brought up earlier.
>

Variable statics are no less thread safe than globals are (nor any
more thread safe). They behave virtually identically.

Constant statics are completely thread safe. If you're doing it just
for the performance improvement, there's no way that threading can
possibly affect it.

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/TXCHUD5WAGZBYVPACDY2TFHZSHL6DWZJ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to