Coding Global Background
Coding Global

Rate my Python codestyle

python
Archived 8 months ago
10 messages
2 members
9 months ago
Open in Discord
R
Michael

Playing Custom Status

Copy Paster!

I'm very used to C and C++ and code in python usually destroys my eyes. But I found some way to return these brackets in Python. The following code was written by deepseek by my instruction, was slightly edited and wasn't tested. ```py import sys; import threading; class NoGILDemo :# def __init__(self) :# self.counter = 0; #; def increment(self) :# #. # This would be thread-safe without GIL for _ in range(100000) :# self.counter += 1; #; #; #; def main() :# #. if (sys.version_info >= (3, 14)) :# print("Running Python 3.14+"); #; else :# print("Python 3.14+ required for GIL-less execution"); return; #; demo = NoGILDemo(); threads = []; for i in range(10) :# t = threading.Thread(target=demo.increment); threads.append(t); t.start(); #; for t in threads :# t.join(); #; print(f"Final counter value: {demo.counter}"); #; if (__name__ == "__main__") :# main(); #; ```

Replies (10)