It's finally Friday! Almost time to enjoy the weekend. How are you going to spend the weekend? My weekend is always so full. Not a moment of free time from the moment I get home from work until I start work again the next Monday. I love to go running on Saturday morning. Nothing better than to complete a 5k. Yes, I'll feel tired, but also accomplished. I'm not as fast or fit as I'd like, but still, it feels good to get out and run. Even if I don't get the time I want, it's great to be able to finish. If I made any progress on fitness on my Saturday runs, I'm definitely subverting it completely with a purchase of donuts and kolaches. Oh well.
I have some wallpapers in my shop now. Definitely worth your Ethereum, in my opinion. I have one as my background right now. You could have one as your background right now too, if you'll buy one of them.
Here's another thing on my mind today - list comprehensions. Do you know about them? In Python, you can make a list comprehension by writing a loop-like expression in square brackets. Something like this: even_numbers = [x for x in range(10) if x % 2 == 0]. Of course you could also do like this: even_numbers = [x for x in range(0,10,2)]. Is that better? It's a different way of doing it, anyway.
Speaking of different ways of doing things, that's one thing that makes software engineering a creative act. Since there's different ways of writing the same code, different people are going to write it in different ways. Take that list of even numbers that I wrote in two different ways. If you came from a different background, like maybe if you grew up studying Pascal or something, you might not think of generating numbers with a list comprehension statement. You might write a loop that looks like "for I := Start to End". That's how things look in Pascal, since there's no such thing like list comprehension there.
Some people might say, why would you still write in Pascal in 2026? Actually, the Pascal language is nicely readable. You declare all your variables up front, organized in their own block. There's a clean separation between definitions and logic. Having distinction of blocks like that encourages clean separation of code. That's an ideal that seems to be lost on this new generation of programmers. Now that AI can write code for you, this whole idea of having clean, readable code just isn't so hyped or popular all the sudden. Now people are like, who cares how it looks as long as it works? But I guess, we should still care, because good code is more than just functional, it's readable. When you read a well written program, you get a story of not just what the program does, but what the programmer was thinking while it was written.
Now again about the list comprehensions. They can save a programmer some typing, giving the ability to express a logical statement in a more concise way. Actually, basically everything you can do with a list comprehension you can do without one. So you don't necessarily need list comprehensions to do what you want to do. You can take that conceptually all the way. You don't need Python to make your computer do something. You don't need C or C++. Heck, you don't even need assembly. Assembly instructions represent byte code, and byte code is what a computer actually runs to accomplish something. Nobody writes byte code though, and for good reason. Logic written only in byte code would be impossibly difficult for a human to follow. That's why we have abstractions in the first place. It's very hard to follow byte code, so we represent the byte code with assembly instructions. Assembly is still kind of hard to follow because abstract concepts are spread out thin. So we represent the assembly code with C. A single line of C code can represent numerous lines of assembly and a single line of assembly can represent several bytes of instructions. Now add Python on top of that, because this one line of Python which has a list comprehension represents several lines of C code.
Now that we have large language models, we can ask the computer for some code that we want, then a single sentence of English can represent numerous lines of Python code. Here's where things can get fuzzy though, because the output of a language model is typically non-deterministic.
Here's the thing about determinism though, when it comes to software that runs on a computer. Computers are good at doing the exact same things over and over again, and they are very poor at doing random things. In fact, try to ask it for a random number, and most of the time the number you get is not truly random. There's this algorithm called a Mersenne Twister. How it works is that you give it some seed, and from that seed you get some interesting random looking numbers. They aren't really random though, because if you input the same seed, you get the same numbers. How can you get things more random looking then, given that the Mersenne Twister doesn't really output random numbers? One way is by doing some tricks with the seed. A common method is using the system time as the seed. By seeding the random function with the current time, you get random output that looks a lot more random.
All this relates back to the list comprehensions I was talking about earlier. Let's say you give an English statement to an AI model - it generates a Python program with a loop. The next time you input the same prompt, it the language model can output a different program and use a list comprehension instead of a loop. So how can you fix that? Fix the seed that the language model uses for its randomness!
There are no comments for this post.
Would you like to leave a comment?