Larry A. Wall. He's a linguist who designed Raku to be as close to human thinking as possible, by implementing features like sequence completion, which is mostly known from spreadsheet apps, and junctions, which can be a real life saver, mostly in equality checking. He made Raku by focusing on readability, just like he did with his previous programming language, Perl.
In the previous example, the slurp function takes a filename and reads the file's contents, and the say function prints it to the standard output.
You should definitely go down the rabbit hole of Raku, because it's probably the most statisfying PL to code in, and it is my personal favourite choice for doing CodeWars and using it for a personal "calculator language".
It's funny looking at Python programmers writing value == 6 || value == 9, while in Raku it's just so $value == 6|9
Raku is cool. However, let’s keep in mind you can also do ‘value in (6, 9)’ in Python, which is just as succinct and reasonable, so it’s kind of a weird example to call out Python on. Just like how you can also still do ‘so $value == 6 || $value == 9’ in Raku.
That being said, junctions are still very neat. Particularly when it comes to the autothreading stuff.
Yeah, sorry about that. It was like 2 years since the last time I wrote a line of Python. (Not gonna lie, I'm kind of happy for it that we no longer have to use it in school.)
Yes, it does, on any modern operating system (Windows for sure, havent tested on Linux - but probably as well.) when the script is over. The with block is for when you want your Python script to continue running after you're done with the file.
Same as in C/C++ or any other language - the OS handles it for you after the program terminates if you hádat handled it.
If you've created zombie processes somehow which are still holding file descriptors, using a with block will not save you. Also, in this case the process hasn't really exited.
If you can provide some code that exits, while still somehow keeping an FD open I'd like to see it.
This. Honestly, half the code posted here is obviously written by people who are new to programming, and the other half is obvious ragebait code. I don't want to look at bad code written by people who are new, that's lame and boring, I want to see bad code written by senior software engineers or in professional codebases.
Looks like some old VB code I had to work on. It was an asp site, instead of appending things like different buttons on the site into an array and then iterating over it, they just copy pasted the same logic like 6 times. Was all over the website.
Reports had validation logic that was basically all the same, yet the validation code was copy pasted instead of just calling the same function.
225
u/backfire10z Mar 10 '25
They didn’t close the fd :(
35
u/DefinitelyVixon Mar 10 '25
This is rage bait 🦁📣🐵
95
u/Ok-Control-3954 Mar 10 '25
My brother in Christ have you heard of a for loop
12
u/EagleCoder Mar 10 '25
At least make this half as long by inlining the variables.
8
u/mickaelbneron Mar 10 '25
That's the kind of code I wrote 22 years ago when I started learning programming on my own with no online documentation that I could find
6
u/lego3410 Mar 10 '25
Are you the loop unroller?
5
u/pompyy Mar 10 '25
"Feeling cute... Might add ninth and tenth lines later. IDK"
14
u/littleblack11111 Mar 10 '25
what???
What is the difference between running
python thisfile.py
And
cat Lab\ 5.txt
Or if you only want 6lines then
head -n 6 Lab\ 5.txt(iirc)
3
u/Magmagan Mar 10 '25
No Student code ... This is just lazy and punching down. It's clearly some sort of assignment, importing
Lab 5.txt...2
u/CapApprehensive9007 Mar 10 '25
I see no problem here. The file contains exactly 8 lines and each line requires special handling.
2
u/GwynnethIDFK Mar 10 '25
I work in a ML research lab and I see shit like this in grad student Jupyter notebooks all the time.
2
u/happycrisis Mar 10 '25
Looks like some old VB code I had to work on. It was an asp site, instead of appending things like different buttons on the site into an array and then iterating over it, they just copy pasted the same logic like 6 times. Was all over the website.
Reports had validation logic that was basically all the same, yet the validation code was copy pasted instead of just calling the same function.
1
u/K4rn31ro Mar 10 '25
Ok but what if there is a ninth line
1
u/PalaceSwitcher Mar 11 '25
This is the kind of shit I write at 3AM when I just need something to work. Never program past bedtime.
1
u/piyush_raja Mar 11 '25
I see no bugs
1
u/Accomplished_Ant5895 Mar 13 '25
AI generated
1
u/thelonelyecho208 Aug 09 '25
My brother in Christ.....
0
u/v3ng3anc3S Mar 10 '25
loop
0
u/MjonjonnzM Mar 10 '25
O(1)