OSError: File or directory not found “C:WindowsSystem32”
Nope. From the spec:
“Unlike Standard C, all unrecognized escape sequences are left in the string unchanged, i.e., the backslash is left in the result.”
This behavior is useful when debugging: if an escape sequence is mistyped, the resulting output is more easily recognized as broken.
Wow, this sentence really threw me for a moment. I had no idea how other programming languages behave.
…which makes sense, because they don’t. The compiler just tells you to fuck off and that’s the end of that story. I guess, they can’t do that in Python…
You call that russian roulette? This is real russian roulette. Dying is a 1/6 probability.
#!/usr/bin/env python3
import random
barrel = [0, 0, 0, 0, 0, 1]
random.shuffle(barrel)
print("Russian Roulette")
for i in barrel:
input("Press enter to shoot")
if i == 1:
print("You are dead.")
exit()
else:
print("Phew. You survived.")
And maybe the fact that you have to continue until the gun actually fires :|
Thought I’m on lainchan for a minute
Wow, a Lain meme was not something I was expecting.
I should watch that show again sometime, I still have the DVDs somewhere I think.
Perfectly safe on Windows, too. The remove() function doesn’t work on directories.
I’m curious. Does anyone like PowerShell, and the syntax you end up with?
Powershell isn’t perfect, but I like it a lot more than anything that takes sh
as a major influence or thing to maintain backwards compatibility with. I don’t think the Unix philosophy of having lots of small tools that do one thing and do it well that you compose together has ever been achieved as I think being consistent with other tools you use at the same time should be part of doing your thing well, and things like sed, grep and perl all having different regular expression syntax demonstrate inconsistency and are easy to find. I also like that powershell is so verbose as it makes it much easier to read someone else’s script without knowing much powershell, and doesn’t end up getting in the way of actually writing powershell as the autocomplete is really good. I like having a type system and structured data, too.
Some of these things are brought to a unixier shell with nushell, but I’m not convinced it’ll take off. Even if people use it, it’ll be a long while before you Google a problem and the solution also includes a nushell snippet, whereas for any Windows problem, you’ll typically get a GUI solution and a powershell solution, and only a maniac would give a CMD solution.
Yeah I’m a big fan of it. People complain about the verbosity of it but I like that for readability and autocomplete makes that a non issue I find. Plus if you really want to save on typing when using it as a terminal tool you can just make aliases for all your common commands.
I work pretty frequently with PS and have no issues with syntax. It’s easy to read and you always have autocomplete so there is just 1 extra click to get from -r to -Recurse. Same command could be also written as this due to alias feature.
rm 'C:' -r -fo
It’s just not the best practice since in PowerShell it is recommended to not use aliases for readability reasons. Also less chance to mess things up due to how verbose all commands and their parameters are.