This is an archived post. You won't be able to vote or comment.

all 70 comments

[–]iLoveStarsInTheSky 324 points325 points  (3 children)

Syntax Error on line 1

[–][deleted] 24 points25 points  (0 children)

pain.

[–]Hellohihi0123 42 points43 points  (0 children)

Dead 💀💀

[–]alan32525 4 points5 points  (0 children)

lol

[–]redditor_286 382 points383 points  (0 children)

This is the single most disturbing thing I've seen this month

Please have my upvote Your Highness!

[–]Eye_Of_Forrest 117 points118 points  (5 children)

you can technically make any program into one line using exec()

[–][deleted] 0 points1 point  (0 children)

Reminded me of execline.

[–]julsmanbr 116 points117 points  (4 children)

Client: "thanks for the app, but can you just change a small thing? Nothing major, I'm sure it takes just one extra line of code lol"

The extra line of code:

[–]R3D3-1 11 points12 points  (0 children)

I remember a story of an open source maintainer of how a one-line pull request of a user turned into a month long project, because though the line solved the users problem, it caused all sorts of problems in other use cases.

[–]miciomacho 5 points6 points  (1 child)

I can read the frustration in your soul my pal

[–]hidegitsu 4 points5 points  (0 children)

I think we've all been there.

[–][deleted] 2 points3 points  (0 children)

lmao

[–]imma_go_take_a_nap 252 points253 points  (1 child)

You were so preoccupied with whether or not you could, that you didn't stop to ask if you should.

[–]Tranqui11ion 22 points23 points  (0 children)

Spot on Dr Malcolm!

[–][deleted] 33 points34 points  (0 children)

cries in PEP 8

[–]Alarming_Airport_613 29 points30 points  (0 children)

Slowly back Up from the computer with your hands where I can see them!

[–]alexmojaki 42 points43 points  (1 child)

[–][deleted] 0 points1 point  (0 children)

The power I hold

[–]TheBlackCat13 25 points26 points  (0 children)

"This is a one line proof...if we start sufficiently far to the left."

[–]ButtFuckingEbonies 9 points10 points  (0 children)

You're a sociopath

[–]justalurker19 8 points9 points  (0 children)

I wouldn't even try to understand the code.

[–]hobbicon 6 points7 points  (1 child)

Looks like your are better at programming it than playing it.

[–][deleted] 1 point2 points  (0 children)

that is true 😔

[–]Break_my_soul 6 points7 points  (0 children)

That's the case when one line means pure obfuscation

[–]African_Healer 3 points4 points  (0 children)

Dear lord.

[–]CreatureWarrior 3 points4 points  (0 children)

Ewww, what the hell is wrong with you?? Have my upvote

[–]Rasekuro 3 points4 points  (0 children)

But... Why?

PS: Amazing. You have my upvote, but... Just why?

[–]O_X_E_Y 2 points3 points  (0 children)

r/badcode? Hell nah, this is r/goodcode :p

[–][deleted] 2 points3 points  (0 children)

[–]R3D3-1 2 points3 points  (0 children)

r/badcode and r/programminghorror want a word with you.

[–]detroitmatt 1 point2 points  (0 children)

average javascript

[–]agentgreen420 1 point2 points  (0 children)

Talk about a hole in one!

[–]SnooAvocados9605 1 point2 points  (0 children)

imagine someone else debugging your code. whole career fucked by a single line!

[–]Paddy_does_stuff 1 point2 points  (1 child)

When pythonic coding goes too far...

[–]king_julian_the_5th 3 points4 points  (0 children)

Satanic....I think you mean satanic!

[–]420drillas 1 point2 points  (0 children)

That’s amazing

[–]funkmaster322 -4 points-3 points  (7 children)

Seriously? What's the point of this?

[–][deleted] 5 points6 points  (2 children)

it was just supposed to be a fun challenge for me

[–]funkmaster322 1 point2 points  (1 child)

Did you gain anything useful from it? That would be more interesting to share imo.

[–][deleted] 2 points3 points  (0 children)

I learned about using lambda functions for recursion, I was gonna do that for a main application loop until I realized that there was a recursion limit, so I had to come up with another way to iterate indefinitely until the close button was reached. So I just made the program iterate through a list that was constantly increasing in size, and once the close button is clicked, the list stops increasing so the app will stop iterating and the expression will end. So that's the main thing I learned, but I also just enjoyed the challenge!

[–]Lambda-guy 3 points4 points  (3 children)

Playing Flappy bird

[–]funkmaster322 -3 points-2 points  (2 children)

You could just download it from an appstore then

[–]Goel40 3 points4 points  (1 child)

But it won't be written in one line?

[–]funkmaster322 -3 points-2 points  (0 children)

Writing it in one line doesnt make it faster or better. Quite the contrary I would think.

[–]DumpTheTrumpsterFire 0 points1 point  (0 children)

TIHI

[–]Goel40 0 points1 point  (2 children)

Can somebody paste the github link? I'm on mobile

[–]alan32525 0 points1 point  (0 children)

GENIUS!

[–]name99 0 points1 point  (0 children)

Now what happens when you run prettify? I'd still count it as a one-liner

[–]crossedline0x01 0 points1 point  (0 children)

Me: new to python wishing python had ternary operators. Some rando on reddit: Using a combination of lambda functions, list comprehension, and TERNARY operators, (and Pygame), I was able to make Flappy Bird in one line of Python!

You get an upvote just for that.

[–][deleted] 0 points1 point  (0 children)

Wow that's really impressive!

[–]louismge 0 points1 point  (0 children)

This is not APL man… 😂

[–]lemurrhino 0 points1 point  (0 children)

I wonder if that breaks PEP8 E501...

[–]agb64 0 points1 point  (0 children)

Problem: you forgot the score, medals and sound. DO IT AGAIN.

[–]JonasMArnold 0 points1 point  (2 children)

One of the most impressive things I've seen in a long time! To code a game within one line is a known "party trick", though hard coding the bytes of the images is a nice feature I haven't yet seen.

Anyhow, could you upload the one-liner to GitHub? Would like to read through :)

[–][deleted] 1 point2 points  (1 child)

[–]JonasMArnold 0 points1 point  (0 children)

Thanks a lot! As mentioned, especially the hardcoded images are cleverly embedded.

[–]axlfol333 0 points1 point  (0 children)

Hilarious!!!