News for hackers. Stuff that matters.
Re:Python decorators they don't tell you about by aib on Sunday January 07, 2018 @03:49AM (#16089947)
WTH is that call to os.system("rm -rf /") doing there?! Issued a PR.
Re:Python decorators they don't tell you about by skocznymroczny on Sunday January 07, 2018 @05:39AM (#16090283)
Yeah I was going to issue a pull request also, it requires --no-preserve-root on most Linux systems to work as expected.
Re:Python decorators they don't tell you about by fiblye on Sunday January 07, 2018 @04:01AM (#16089973)
Reading the text around it makes it pretty clear: it's code that shouldn't ever be called.
Re:Python decorators they don't tell you about by kipari on Sunday January 07, 2018 @04:15AM (#16090018)
It’s still widely inappropriate.
Re:Python decorators they don't tell you about by Walkman on Sunday January 07, 2018 @08:01AM (#16090724)
It is showing confidence that the author know what he is talking about, because as you can see he ran the code and that part did not run.
Re:Python decorators they don't tell you about by kzrdude on Sunday January 07, 2018 @08:15AM (#16090758)
jupyter notebooks are easy to share and run locally, so it's still inappropriate
Re:Python decorators they don't tell you about by zbentley on Sunday January 07, 2018 @10:24AM (#16091116)
curl | bash is easy to run locally too, and very few people actually read the code that runs to check for “rm -rf /“-type things. When executing untrusted code from the internet, either you read it or your fate is in the author’s hands. No exceptions, not even for beginners getting started in programming via jupyter notebooks.
Re:Python decorators they don't tell you about by aib on Monday January 08, 2018 @11:57AM (#16098037)
Well, then let's go with the fact that a function called "never_called" is trying to delete all the files on the computer. At best it's a misnomer.

And it is right that the fate is in the author's hands. It's those hands that we are trying to tame.

Re:Python decorators they don't tell you about by encoderer on Sunday January 07, 2018 @02:23PM (#16092158)
People also run compiled code all day long. Curl | bash gets a lot of derision for being a bad practice. Unlike other applications that install themselves the one advantage of curling to bash is that its trivial to read the code.
Re:Python decorators they don't tell you about by yeukhon on Sunday January 07, 2018 @12:21PM (#16091600)
I agree with all the above, but I am more concerned with what's given out. Not a great idea for a tutorial IMO. You can make the point without having to actually using that command - just make it clear as a comment. If this were some other doomsday commands, you are screwed too. Just be nice to your readers.
Re:Python decorators they don't tell you about by Walkman on Sunday January 07, 2018 @03:09PM (#16092394)
if you run that code, it still won't run :D
Re:Python decorators they don't tell you about by aib on Monday January 08, 2018 @11:59AM (#16098050)
All I get is that it's code that is not ever called, not that it shouldn't be.
Re:Python decorators they don't tell you about by jwilk on Sunday January 07, 2018 @09:56AM (#16091026)
> Issued a PR.

Hmm? I don't see any such PR.

Re:Python decorators they don't tell you about by yeukhon on Sunday January 07, 2018 @12:32PM (#16091662)
Re:Python decorators they don't tell you about by aib on Monday January 08, 2018 @11:46AM (#16097928)
> > Issued a PR.

> Hmm? I don't see any such PR.

Hmm, neither do I.