3 ms·
you realize this is not a concern because nobody in the last 20 years uses global?
by mynewaccount00 1y ago
you realize this is not a concern because nobody in the last 20 years uses global?
- kg 1y agoAn incrementing global counter is a pretty common scenario if your goal is to have guaranteed-unique IDs assigned to objects within a process, especially if you want them to be sequential too. I've got counters like that in various parts of code I've shipped, typically incremented using atomics.
- sillythrowaway7 1y agoIt is a pretty common scenario if you don’t follow almost two decades worth of best practices and suggested alternatives and advice
- immibis 1y agoCan you show us some of this advice?
- mynewaccount00 11mo ago... Not using globals? Pass the value around, use recursion, and keep state as local as possible.
- immibis 11mo agoI'd like you to show: How to write Python code with no globals And a source other than you saying you should do it this way
- pphysch 1y agoIs that global counter really the only dependency? No database connections or anything that would warrant some proper dependency injection?