![](/static/253f0d9b/assets/icons/icon-96x96.png)
![](https://lemmy.world/pictrs/image/c47230a8-134c-4dc9-89e8-75c6ea875d36.png)
Dang, that reads like a commercial for pharmaceuticals.
Dang, that reads like a commercial for pharmaceuticals.
Didn’t kbin have a separate mechanism for supporting a post in a more public way? I can’t remember how that worked now, but it was in addition to the regular voting I think?
Know better than to be in Kursk?
Nice. I had been using the analogy that an introvert at a party acts as a sacrificial anode consuming corrosive extroversion until they are utterly exhausted. But I like your take on it!
I’ve been on long flights where I wished there had been designated seating for introverts. But then I considered the implications of packing all the extroverts together in one place nearby and thought better of it.
My understanding is that Russian athletes have been competing as independents, which is a different category from refugees. But apparently, they have been barred from competing in events that also include Ukrainians.
If I’m not mistaken, they have actually medalled, which is better than some countries.
The thing about the MPW Shell is it was sort of the only game in town if you actually wanted a command line with the classic Mac OS. (There’s an awesome little emulator called SheepShaver if you ever want to explore it btw.) Well, I suppose there was A/UX. I thought it was a miracle when that came out. You have to realize in those early days a good chunk of the operating system itself was actually baked in to ROM. (You had to do desperate things to squeeze a GUI out of such limited resources as existed back then!) So to this day I have no idea how they managed to spin off a 'nix despite that.
Anyways. I wonder, if you made some sort of template format today, to what extent you could write some sort of conversion tool that would scrape a man page or whatever to rough it in and then you could tweak it to get what you want? man pages aren’t super standardized in their format I guess, so it’s probably more trouble than it’s worth. I like to use Python’s argparse
when rolling out scripts myself, and its --help
format is pretty rigid given that it’s algorithmically generated. Might be more plausible with something like that? I had a quick look just now to see if you can drill down into the argparse.ArgumentParser
class itself to pull out the info more directly, but it seems a rather opaque thing that doesn’t expose public APIs for that. Oh well…
This reminds me of something from my ancient past. Back in the early-ish days of Apple, there was a development system called MPW (Macintosh Programmer’s Workshop) which included its own little kludgy shell.
The weird thing about it though was while you could enter commands on the command line like in any shell, you could prefix them with the word commando
(presumably a portmanteau of “command” and “window”) and this window would pop up showing various buttons, checkboxes, etc. correponding to command line options. When you ok’d the window, it would generate the command line for you.
I’m rather hazy about how all this worked, but I think there was some sort of template language to define the window layout if you wanted to add commando support for your own tool? And presumeably, as you say, you could restrict what’s possible with the window interface as you deemed fit?
Holy smokes this is awesome! In cpython 3.13 you’ll just be able to go python --disable-gil
.
Fair, though I guess my interpretation was that void*
is kind of like a black hole in that anything can fall into it in an unsettling way that loses information about what it was?
I think I could get very nervous coding for the military, depending on what sort of application I was working on. If it were some sort of administrative database, that doesn’t sound so bad. If it were a missile guidance system, on man! A single bug and there goes a village full of civilians. Even something without direct human casualties could be nerve-wracking. Like if it were your code which bricked a billion-dollar military satellite.
Speaking of missile guidance systems, I once met someone who worked a stint for a military contractor. He told me a story about a junior dev who discovered an egregious memory leak in a cruise missile’s software. The senior dev then told him “Yeah, I know about that one. But the memory leak would take an hour before it brings the system down and the missile’s maximum flight time is less than that, so no problem!” I think coding like that would just drive me into some OCD hell.
I have only written potentially life-threatening code once in my life. It had to do with voltage/current regulation in the firmware of a high-powered instrument used by field workers at the company where I work. It was a white-knuckled week I spent on just a single page of code, checking and re-checking it countless times and unit testing it in every conceivable way I could imagine.
Fair enough. I’m just looking for some independent confirmation as this is pretty big news.
Is this official though, or wishful thinking on the part of Cameron?
Actually, now that I think of it, there’s no reason you need to join the 2 names into a single str
. You could just leave it as a tuple
of last, first and Python will know what to do in comparing them.
>>> sorted(student_ids, key = lambda i: ((rec := student_recs[i])['last'], rec['first']))
[632453, 1261456, 532153]
So the lambda would be returning ('Potter', 'Harry')
rather than 'Potter, Harry'
. But whatever. The :=
part is still the same.
Can you use it to initialize vars outside the scope of the lambda?
No, that’s not what it’s for. It lets you define a temporary local variable within an expression. This is useful in situations where you might want to use the same value more than once within the expression. In a regular function, you would just define a variable first and then use it as many times as you want. But until the walrus operator came along, you couldn’t define a variable within a lambda expression.
Can you give an example?
Ok, I’m trying to think of a simple example. Let’s say you had a database that maps student IDs to records contain their names. To keep things simple, I’ll just make it plain old dict
. And then you have a list
of student IDs. You want to sort these IDs using the student names in the form “last, first” as the key. So you could go:
>>> student_recs = {1261456: {"first": "Harry", "last": "Potter"}, 532153: {"first": "Ron", "last": "Weasley"}, 632453: {"first": "Hermione", "last": "Granger"}}
>>> student_ids = [1261456, 532153, 632453]
>>> sorted(student_ids, key = lambda i: (rec := student_recs[i])['last'] + ', ' + rec['first'])
[632453, 1261456, 532153]
The problem here is that student_ids
doesn’t contain the student names. You need use the ID to look up the record that contains those. So let’s say the first ID i
is 1261456
. That would mean:
rec := student_recs[i]
evaluates to:
{"first": "Harry", "last": "Potter"}
Then we are effectively going:
rec['last'] + ', ' + rec['first']
which should give us:
'Potter, Harry'
Without the :=
you would either have to perform 2 student_recs[i]
look-ups to get each name which would be wasteful or replace the lambda with a regular function where you can write rec = student_recs[i]
on its own line and then use it.
Am I making any sense?
They’re somewhat more capable now that we have the walrus (:=
) operator.
One thing most text editors can do is print. I was shocked the other day when I couldn’t print a readme from vscode when someone asked for hard copy.
Spent breakfast researching this: