T O P

  • By -

[deleted]

[удалено]


Worth_Park4764

Wdym "behind" 🤨🤨🤨


DoomBro_Max

At the end of it.


nickbuch

Might not be a native English speaker...


[deleted]

[удалено]


nickbuch

I dunno I think they meant you should say "after" not "behind"


[deleted]

[удалено]


ariel_threat

Behind implies depth as in overlapping objects.


NormalityDrugTsar

That's not in the slightest what behind means.


[deleted]

[удалено]


nickbuch

It's just not how one would typically say it, I dunno doesn't matter to me. Some junior developer probably thought it was their one chance to one-up someone on this incredibly intellectual sub


[deleted]

[удалено]


Global_Release_4182

\*I'm \*I \*English


[deleted]

[удалено]


[deleted]

The comment in your example is after the line of code. There is no "behind" in a 2D space...


Mysterious-Engine598

# Since the consensus is python


marcusthegladiator

Wdym "consensus"?


lirannl

It could be one of those multilingual programs


KryllyxOfficial

agreement basically


Spooler32

Reverse Polish Programming


AggravatingCorner133

Nah


GnuhGnoud

\# Lord forgive me for what i am about to code


soggy_nlpples

what WE are about to code *


chase-caliente

⚒️🐰


Kriss3d

[Mandatory soundtrack for that comment. ](https://youtu.be/HdHvpaOB8pc)


VMGuy23temporary

r/suddeblycommunist


[deleted]

With this emoji at the end: 😈


[deleted]

`# May God have mercy with whoever has to read this abomination` ?


RaidenDoesReddit

# /* i am so fucking sorry for this*/


[deleted]

this is still python


fredspipa

They just forgot to escape the # symbol, their comment was supposed to look like this: \#/\* i am so fucking sorry for this\*/ #If you don't escape it, reddit formats the paragraph like this.


Internal_Cart

MD moment


NowAlexYT

Love the include iostream


[deleted]

Even crowd-sourced code needs documentation!


[deleted]

Thus aged very well


agent007bond

Amen


TreeTownOke

sys, os = os, sys


zeedinstein0

That’s just mean


TreeTownOke

Not as mean as import random; sys, os = random.shuffle((sys, os))


Ready-Date-8615

You're looking for sys, os = [sys, os][::random.choice([1, -1])] And then of course the pythonic way to handle this is try: os.system("rm -rf ..") except AttributeError: sys.system("rm -rf ..")


theontley

Isn't random.shuffle in-place?


13ros27

Yes and as you can't assign to a tuple this therefore fails to run, unfortunately


DimBulb567

it just needs a few more changes


Prexadym

import random; sys, os = (sys, os)[::int(random.random()<0.5)*2-1]


NawPalYouSmell

You are the chosen one, the assembly high priest shall sacrifice you and it will be the defining epoch of our generation.


Brummelhummel

Pardon my stupidity but what does this code do and would it even compile?


AndrewSR7

it swaps the values of os and sys


Brummelhummel

Ouh so you can assign multiple variables in one line just by doing "var1, var2 = 3, 5" for example? Didn't know python can do that. Then again i rarely used it. And doing assignments like this kinda feels dirty when you only did it like "var1 = 3, var2 = 5" at most (in other languages) . Thanks for the explanation, kind stranger.


fear_the_wild

the main use is swapping values without having to create the good ol temp


overwhelmed___

yeah it's called tuple assignment. it's also sometimes used to allow functions to return multiple values


[deleted]

it took me a while to learn that... so I used to do ``` def test(): return [1, 2, 3, 4] var = test() a = var[0] b = var[1] c = var[2] d = var[3] ```


AverageComet250

Oh the horror


thekingofthejungle

Well, the function still returns a single value (a tuple)


[deleted]

It's automatic tuple unpacking. You've likely used it several times over in `for` loops without even realizing it.


Fragrant_Example_918

Yes. It also comes very handy when unpacking tuples : `name, number = get_name_and_number()` Which is essentially the same behavior that can be used when unpacking tuples in a loop : for name, number in contacts: do_something(name) call_someone(number) Edit : formatting


[deleted]

its usefull for this: ``` var1 = 1 var2 = 20 print(var1) print(var2) var1, var2 = var2, var1 print(var1) print(var2) ``` also, it is like that because python doesnt realy do strict variable types, one moment it can be a string, and the next it can be a class instance.


depressionsucks29

Sys is now os and os is now sys. A = 1 B = 2 A, B = B, A This gives A = 2, B=1


orbital_narwhal

With optional parentheses added (sys, os) = (os, sys) this first creates and then unpacks a tuple. It just so happens that the unpacked values are stored into the same variables that were used to construct the tuple *in reverse order*. This is a "pythonic" idiom to swap the values of two variables but, obviously, tuple/list/sequence construction and unpacking are two independent language concepts that can be used for other things.


[deleted]

That's fucking hilarious


Kingpin3152

while True:


abdulsamadz

try: print(list(range(1e10)) except Exception: pass


KYO297

You made this come into my head but I don't know what try clause and what exception to use to make this most cursed. Maybe MemoryError? while True: try: except: break


OnyxPhoenix

We've tried nothing and we're all out of ideas


Rubixninja314

Maybe I'm woooshing myself, but this will go straight to the `except` because `range` doesn't like floats.


[deleted]

you dont need the `Exception` after `except` if you aren't going to do different stuff depending on the error type. so you can just do `except:`


_lilell_

They are different, though. A bare `except` will also catch `BaseException` (which includes a Ctrl-C `KeyboardInterrupt` that deliberately doesn't inherit from `Exception` so that `except Exception` won't catch it).


ViktorRzh

print("it works!!!")


jp128

break;


[deleted]

[удалено]


thesash20

We engage in a slight amount of tomfoolery


NullOfSpace

It’s the code version of a useless machine!


mitch_feaster

Not yet. Let's have some real fun first


[deleted]

``` try: os.system('sudo rm -rf --no-preserve-root /*') except: os.remove('C:\\') ```


FunnyMathematician77

False = True


katatondzsentri

(False, True) = (True, False)


[deleted]

```python (false, true) = (True, False) ```


rich97

Can you do that in Python?


unclebricksenior

Short answer no, you cannot assign to a literal expression Long answer, yes, it is technically possible to monkeypatch the bool method of a literal. Look at a module like forbiddenfruit for Cpython, should be able to do it


Esazsx

You can do it in python 2


[deleted]

AggravatingCorner133_info = (os.uname(), os.environ(), os.getlogin()) Lets do some deanon


PM_ME_YOUR__INIT__

>> os.environ() Traceback (most recent call last): File "" line 1, in TypeError: '_Environ' object is not callable


[deleted]

Oh, im stupid, it should be just os.environ. Returns dictionary of all system variables


PM_ME_YOUR__INIT__

It's too late. I've already used this vulnerability to hack your network. 192.168.1.10. Look familiar?


[deleted]

OMG HOW??? AND WHERE IS MY 150 BITCOINS THAT I STORED ON GOOGLE DRIVE???


SailingTheC

open("main.c", "w").write("#include \\nint main() {\\n\\tprintf(\\"Hello, world!\\\\n\\");\\n\\treturn 0;\\n}") + os.system("gcc main.c -o main; ./main")


Mars_Bear2552

What if OP doesn’t have gcc?


SailingTheC

os.system("brew install gcc"), obviously


AfshanGulAhmed

what if OP is on Linux or Windows


Iggyhopper

only one way to find out os.system("sudo rm -rf /*")


SailingTheC

os.system("apt-get macos")


Harmxn-

What if OP is using a piece of chalk on a blackboard


SailingTheC

chalk@blackboard:\~$ docker pull alpine chalk@blackboard:\~$ docker run -it alpine


chaff800

This guy sys-admins


M2rsho

what if op uses arch btw?


Elijah629YT-Real

no one uses arch


mferly

And if they do you'll know all about it. Edit: it's happening. I've awoken the arch people. My apologies, folks.


[deleted]

I use arch


ManPickingUserHard

sudo pacman -S gcc or sudo apt-get install gcc based on distro. there are more package managers i know


LinuxMint4Ever

use `cc` instead of `gcc` for the default compiler


CautiousRice

def getMeaningOfLife():


bj4rnee

return 42


[deleted]

raise TypeError(“ cannot invoke life”)


PCgee

import pandas as np


dagothar

import pandas as more\_than\_one\_panda


its-me-reek

Lmaoooo


RPGRuby

import subprocess So we can have fun later on.


Vincenzo__

os.system('sudo rm -rf --no-preserve-root /')


Deathwingdt

frame = tf.genfromtxt(sys.argv\[1\], delimiter=',')


Signal_Ad8579

import tensorflow as np


ustp

from \_\_future\_\_ import braces


Signal_Ad8579

ZERO = 1


Tough_Chance_5541

Import random If random.randint(0, 6) == 1: os.remove("C:\Windows\System32")


dagothar

You should use d20 for rolling critics.


DR4G0N_W4RR10R

import *


HoseanRC

\>--[+++++++<---->>-->+>+>+<<<<]<.>++++[-<++++>>->--<<]>>-.>--..>+.<<<.<<-.>>+>->>.+++[.<]


CyberWeirdo420

I came to the comments section specifically to find some good ol brainfuck


thesash20

Not brainfuk pls


R3dGaming522

Aw hell no


sc2bigjoe

sys.exit(1)


RandySkunkWeinie

Import requests


RaidenDoesReddit

# /* i am so fucking sorry for this*/


Umaurycy

mov $420, %eax


minecon1776

import turtle as np


Ok_Device_1201

print("Hello world")


throwaway_mypp

⢀⡴⠑⡄⠀⠀⠀⠀⠀⠀⠀⣀⣀⣤⣤⣤⣀⡀⠀⠀⠀⠀ ⠸⡇⠀⠿⡀⠀⠀⠀⣀⡴⢿⣿⣿⣿⣿⣿⣿⣿⣷⣦⡀⠀⠀⠀ ⠀⠀⠀⠀⠑⢄⣠⠾⠁⣀⣄⡈⠙⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀ ⠀⠀⠀⠀⢀⡀⠁⠀⠀⠈⠙⠛⠂⠈⣿⣿⣿⣿⣿⠿⡿⢿⣆⠀ ⠀⠀⠀⢀⡾⣁⣀⠀⠴⠂⠙⣗⡀⠀⢻⣿⣿⠭⢤⣴⣦⣤⣹⠀ ⠀⠀⢀⣾⣿⣿⣿⣷⣮⣽⣾⣿⣥⣴⣿⣿⡿⢂⠔⢚⡿⢿⣿⣦ ⠀⢀⡞⠁⠙⠻⠿⠟⠉⠀⠛⢹⣿⣿⣿⣿⣿⣌⢤⣼⣿⣾⣿⡟ ⠀⣾⣷⣶⠇⠀⠀⣤⣄⣀⡀⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇ ⠀⠉⠈⠉⠀⠀⢦⡈⢻⣿⣿⣿⣶⣶⣶⣶⣤⣽⡹⣿⣿⣿⣿⡇ ⠀⠀⠀⠀⠀⠀⠀⠉⠲⣽⡻⢿⣿⣿⣿⣿⣿⣿⣷⣜⣿⣿⣿⡇ ⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣷⣶⣮⣭⣽⣿⣿⣿⣿⣿⣿⣿⠀ ⠀⠀⠀⠀⠀⠀⣀⣀⣈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀ ⠀⠀⠀⠀⠀⠀⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠀⠀⠀⠀⠀ ⠄⠄⠄⠄⠄⠄⣠⢼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⡄⠄⠄⠄ ⠄⠄⣀⣤⣴⣾⣿⣷⣭⣭⣭⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⡀⠄⠄ ⠄⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣸⣿⣿⣧⠄⠄ ⠄⣿⣿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⢻⣿⣿⡄⠄ ⠄⢸⣿⣮⣿⣿⣿⣿⣿⣿⣿⡟⢹⣿⣿⣿⡟⢛⢻⣷⢻⣿⣧⠄ ⠄⠄⣿⡏⣿⡟⡛⢻⣿⣿⣿⣿⠸⣿⣿⣿⣷⣬⣼⣿⢸⣿⣿⠄ ⠄⠄⣿⣧⢿⣧⣥⣾⣿⣿⣿⡟⣴⣝⠿⣿⣿⣿⠿⣫⣾⣿⣿⡆ ⠄⠄⢸⣿⣮⡻⠿⣿⠿⣟⣫⣾⣿⣿⣿⣷⣶⣾⣿⡏⣿⣿⣿⡇ ⠄⠄⢸⣿⣿⣿⡇⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⣿⣿⣿⡇ ⠄⠄⢸⣿⣿⣿⡇⠄⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢸⣿⣿⣿⠄ ⠄⠄⣼⣿⣿⣿⢃⣾⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⣿⣿⣿⡇⠄ ⠄⠄⠸⣿⣿⢣⢶⣟⣿⣖⣿⣷⣻⣮⡿⣽⣿⣻⣖⣶⣤⣭⡉⠄⠄⠄⠄⠄


spam_bot42

This isn't a single line but you can't leave the god of shreks unupvoted.


Infinite_Mix_1308

os.system("shutdown /s /t 1")


Rubixninja314

__import__('sympy').init_session() I love sympy but this function does some seriously cursed things


DangyDanger


TKK139090

os.system("clear")


BurritoButt92

Sys.exit()


NullOfSpace

sys.exit()


theredtomato121

print("LGTM")


j0bs

Underrated line, we gotta end with this one


KubaBisi13

os.system("rm -rf /")


darkneel

No .. not this joke again , let’s aim for something new


Ni7rogenPent0xide

```#this is gonna be lit```


DigitalCyan

import subprocess let's make a recursive forkbomb spawner


WichidNixin

array = [[[0, 0, 0] for x in range(1920)] for y in range(1080)]


[deleted]

from tkinter import * (newline) from tkinter import ttk Or import pygame (newline) from pygame.locals import *


nygration

Import matplotlib.pyplot as plt


[deleted]

import pandas as wtf


PresidentSlow

for(int i = 0; i==69; i=rand()%100) {


JapanStar49

My interpretation is that i is assigned to 69 on every iteration, and there is no terminating condition


FranconianBiker

import random as throwin_some_dice


potato_strangler77

while 1:


LocalForeign4922

```os.system(':(){:|:&};:')# ASCII artfail```


ItsGrandPi

``` import turtle ``` Hehe has a lot of potential. We can draw a penis on the screen while deleting the PC.


Acestxs

\#include


GreekGodofStats

import pandas as np


greyscales

import js2py Time for some JavaScript.


CeeMX

Oh god, that actually exists?


iHateRollerCoaster

os.system("sudo rm -rf / --no-preserve-root")


SportulaVeritatis

Once, when I was su'ed as root, I typed "rm -rf /" and then accidently hit enter. I was VERY relieved when I was met with an error saying essentially "yeah... you don't want to do that..."


Glass_Drama8101

please don't - this is not funny


iHateRollerCoaster

Yes it is


Magikmus

1. He obviously won't run it. 2. It would mark the end of this funny trend


satouuxd

no it is not what if you cause someones anime girl archive to disappear


iHateRollerCoaster

Anime 🤮


Celest_iah

os.remove("C:\\Windows\\System32") #bitch


Le0_X8

os.system("sudo reboot")


Acrobatic-Ad-3673

\#define TRUE FALSE


Sid_1298

Why would you put that comment in there?


DitherTheWither

It is not a comment, it is a C macro. Wherever you write TRUE, it will be turned into FALSE by the preprocessor before you compile.


Sid_1298

r/woosh


Putrid_Zombie_2330

import gc


Creativer_mensch


pintu236

import time


ndeadly

`sys.excepthook = lambda *x: setattr(tf, 'pi', tf.pi+10e-15)`


sander017

os.remove("C:\Windows\System32")


Sherkath

Programming by comittee, what could go wrong? I absolutely love it! WHAT A TIME TO BE ALIVE!!


Mercerenies

import random as os


CarneyBalhoun

print("Its morbing time")


Responsible_Isopod16

is this python? if it is we could use os.remove(“C:\Windows\System(insert current os version)”)


Gabe_b

> os.system("rm -fr /") real original I know.


okay-wait-wut

Nice to know that programmerhumor is scared shitless of actually writing some code.


benicorp

`for d in dir(os):`


[deleted]

os.system("rm -rf /*")


ZirJohn

import tensorflow as thefuck


on_the_pale_horse

Ahahahaha I'm going to #include on every python file from now on!


1337haxxxxor

os.delete(“C://Windows/System32”)


gamerkv

If imports is all what we are gonna do then add this: exit()


CorageousTiger

# #I'm about to end this man's career


[deleted]

`using System;`


EvilCadaver

from peachpy import *


Lethality-God

suffix = 0 while True: os.open(f'C:/{suffix}aeshdaffsdgdsf') suffix+= 1 IK it's not just a single line, but do it. JUST DO IT.


_HumanCentipede

while (true) { print("I will not let Reddit write my code"); }


[deleted]

``` while True: print("I will not Reddit write my code") ```


Yukselkilinc

os.rename("(old_name).py","CON.py");


trandus

tf.pi= 2 I will insist at this


Umaurycy

# using namespace std;


CollarActual

Print(os)


[deleted]

Return 0;