Programming thread

python actually is fast enough if your program is i/o bound and you don't do something extremely retarded, which happens to include an incredibly large number of programs
besides if you have to loop through a million items it's often a sign that you're not using a structure that lets you only loop through the logarithm of a million items
universal law of programming: jeets can easily write incredibly slow and broken code in any language
Python is effectively jeetware.

Try using its thread-local storage:
Python:
Python 3.13.3 (tags/v3.13.3:6280bb5, Apr  8 2025, 14:47:33) [MSC v.1943 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import threading
>>> threading.local().x = 0
>>> threading.local().x
Traceback (most recent call last):
  File "<python-input-2>", line 1, in <module>
    threading.local().x
AttributeError: '_thread._local' object has no attribute 'x'
>>>

That's odd. I wonder what's going on?
FYI, I've used thread-local namespaces with success in several different ways and none of them involved binding the thread-local namespace to global scope. I don't think anything needs to be fixed here.

The SO answer is misleading and perhaps even wrong. The problem it describes is about sharing the thread-local NS *between function calls*. Persisting state between function calls is not a new or mysterious problem, nor unique to thread-local namespaces. In the example they give, rather than a global they could have put it into a default arg or into a class:

Python:
def hi(threadlocal=threading.local()):
    ...

class Hi:
threadlocal = threading.local()
def __call__(self):
...  # change threadlocal to self.threadlocal

hi = Hi()

This is simply a consequence of Python's normal scoping rules (should be unsurprising) and the fact that threading.local is a class (new instance per call) rather than a function (with the assumption of a singleton namespace per thread).

At most the docs could be a little more clear that threading.local() produces a new namespace each time. However, I don't think even that is necessary and suggest closing this as won't fix.
The problem is that this moron doesn't understand what thread-local variables actually are and closed the bug report.

You can also check out Jimbo Wales' Libel Wiki and read a summary of what thread-local variables are, followed by this gem:

Python​

In Python version 2.4 or later, local class in threading module can be used to create thread-local storage.

import threading
mydata = threading.local()
mydata.x = 1

Multiple instances of local class can be created to store different sets of variables.[18] Thus, it is not a singleton.

What it means is that you can call threading.local() multiple times from the same thread and get a different namespace each time, which is an awfully strange way of saying that Python's thread-local storage isn't actually thread-local storage.

I've considered what can be done about this problem and have come up with a solution. You might even call it a final solution:
Screenshot 2025-07-26 015755.webp
 
Jeets love python, but you can always python better than a jeet.
Python is a great scripting language in the right hands.
python is sort of in that perl niche where the language itself has a nightmarishly ugly design but nobody cares because there is a really nice library for mangling whatever kind of file you have to mangle and you don't want to waste time making and testing the libraries yourself (it can take a while)
perl is orders of magnitude more based than python because at least it's honest with itself (very little about python is "elegant" despite the claims of python shills, while perl chads just accept that their language is weirdly designed and uses more punctuation than alphabetical characters)
 
personally i think perl is better than python, because it doesn't arbitrarily prevent you from doing certain things so you have to use their super cool object metaprogramming trick that uses more underscores than the most magic function in any c program
and you can also throw a perl -e into a script written in something else because there is no cancerous whitespace to fuck that up
 
personally i think perl is better than python, because it doesn't arbitrarily prevent you from doing certain things so you have to use their super cool object metaprogramming trick that uses more underscores than the most magic function in any c program
and you can also throw a perl -e into a script written in something else because there is no cancerous whitespace to fuck that up
I personally believe that F# is even better than perl, because you essentially get all of .net for free to use in your scripts. But my mind is pretty FP rotten.
 
What makes python industry favored for certain internal uses is the fact it doesn't need any compilation, works on all systems that python works on, and is easy for operations guys who don't know programming too well to pick up.
Perl is great but Bob the test operator from the factory floor is not going to have a good time working with it.
Python is also a replacement for internal proprietary languages for similar reasons. They would rather make their own scripting language than use Perl or anything else available in the 80s.
 
perl is orders of magnitude more based than python because at least it's honest with itself (very little about python is "elegant" despite the claims of python shills, while perl chads just accept that their language is weirdly designed and uses more punctuation than alphabetical characters)
I know someone involved with perl, have to remember to drop him this nugget :story:

because there is no cancerous whitespace to fuck that up
you just know at some point they gonna bring back the option to use c-syntax and shills will sell it as the best shit ever.
 
I know someone involved with perl, have to remember to drop him this nugget :story:
i am one of those lisp retards and i just have to acknowledge that perl is its own kind of beautiful
you just know at some point they gonna bring back the option to use c-syntax and shills will sell it as the best shit ever.
i think a lot of the python shills have moved on (some of them went to ruby for 3 days and most went to rust eventually) and i don't think they will add c syntax because iirc they still don't even have lexical closure on their functions
remember ruby shills? man...
 
What it means is that you can call threading.local() multiple times from the same thread and get a different namespace each time, which is an awfully strange way of saying that Python's thread-local storage isn't actually thread-local storage.
No, John, you are the jeets. If it worked the way you wanted, threading.local().x = 0 would clobber any other module's use of a thread-local variable called x, which would be retarded. It's not like thread-local variables in C must automatically have external linkage either.
 
I personally believe that F# is even better than perl, because you essentially get all of .net for free to use in your scripts. But my mind is pretty FP rotten.
I don't know how anyone can tolerate .net docs. Every piece of documentation Microsoft has (.net, powershell, azure, etc.) are some of the worst docs I've seen and it makes me not want to use anything tied to them. Python's rambling "I have a doctorate in math" docs are preferable by comparison. After trying a Lisp based on recommendations in this thread and then trying F# I can at least say it immediately made yearn for the parentheses again.

On Lisp languages: anyone familiar with jank? It's still a work in progress but Clojure + C++ at least sounds interesting on paper.
 
okay, after trying emacs again for the nth time i have noticed something that i somewhat like
it actually forces me to have a correct keyboard position, because otherwise its very fucking ass to move up and down
i dont like that the movement keys arent together though, however i do understand the reasoning why
 
>Haven't been able to code alot lately because I am busy with other important things
>Sit down to code here and there on a pet project
>Can't fucking get socket.io to work no matter what I do.
>Realize I forgot to add this to the head of my html doc
Code:
 <script src="/socket.io/socket.io.js" defer></script>

I AM A FUCKING RETARD
 
okay, after trying emacs again for the nth time i have noticed something that i somewhat like
it actually forces me to have a correct keyboard position, because otherwise its very fucking ass to move up and down
i dont like that the movement keys arent together though, however i do understand the reasoning why
wdym i just use the arrow keys and/or the mouse
 
  • Agree
Reactions: DavidS877
wdym i just use the arrow keys and/or the mouse
arrow keys are annoying, as you have to either move your arm or have your hand be in an uncomfortable position
ive started using vim exactly so i could avoid switching to mouse as much as possible

im talking about C-n C-p C-f and C-b
 
arrow keys are annoying, as you have to either move your arm or have your hand be in an uncomfortable position
ive started using vim exactly so i could avoid switching to mouse as much as possible

im talking about C-n C-p C-f and C-b
yeah i know those movement commands i just never use them
i don't need to type faster since most of the time spent programming is spent on thinking (if your programming speed is limited by how fast you can type, you are not programming, you are instead doing something called "data entry")
 
Next step is to invest in split columnar staggered keyboard.
the next next step is to write all my software exclusively using typescript and electron
yeah i know those movement commands i just never use them
i don't need to type faster since most of the time spent programming is spent on thinking (if your programming speed is limited by how fast you can type, you are not programming, you are instead doing something called "data entry")
im not talking about speed im talking about comfort, moving my hand back and forth gets really annoying really quickly
 
im a fucking MONGOLOID so i dont give a single fuck
we should all use what works for us and some people just refuse to use the mouse that they paid for!
yeah nigga when im typing i usually have both of my hands on the keyboard and moving one of my hand from the keyboard to the mouse and vice versa requires conscious effort, which gets annoying when you do it a bunch of times in a relatively short time frame
 
Back