r/interestingasfuck Jul 21 '21

Chicken with genetic defect /r/ALL

https://i.redd.it/98g39eh4pjc71.jpg
53k Upvotes

View all comments

Show parent comments

1k

u/Reddit-username_here Jul 21 '21 edited Jul 21 '21
def de-evolution(chicken):  
    if Humans.eatingChicken():  
        chicken = dinosaur  
        return chicken  
    else:  
        return chicken

Edit: probably shouldn't have camel cased that method name, ey?

Edit 2: thanks for the award stranger! I'm on the beta of the 3rd party app I use and it hasn't been getting the award messages from Reddit recently, so I can't thank you privately!

831

u/sniper_cze Jul 21 '21

Too complicated :)

def de-evolution(chicken):
    if Humans.eatingChicken():
        chicken = dinosaur
    return chicken

365

u/Reddit-username_here Jul 21 '21

Also, chicken is just a reference to dinosaur now, instead of being a dinosaur. Hopefully that doesn't cause any bugs down the road.

Well, it's working on my computer, I'm gonna go ahead and commit this, alright?

169

u/shayanzafar Jul 21 '21

No need for unit tests either. If it doesnt work ill just tell the client to use my laptop. Where i have confirmed it is working.

108

u/Reddit-username_here Jul 21 '21

SHIP IT!

47

u/shulatocabron Jul 21 '21

They needed yesterday!

26

u/Reddit-username_here Jul 21 '21

Look man, that's Op's problem. I just write the shit!

21

u/Flauni Jul 21 '21

Sales promised client flying sabretooth tigers

Edit: Just heard from marketing that they’ve already sent out the press release.

3

u/Andrewmundy Jul 21 '21

Our stock price is still falling, mgmt just cut benefits.

3

u/[deleted] Jul 21 '21

Dude, you have a Reddit account. Go to Wallstreetbets and get the apes on it!

2

u/rabbitthethinker Jul 21 '21

Im actually all of your IT people. Just stop! We both know your code is going to explode dino-chicken-sapiens everywhere. So just don't do it today, ok? I'll get beer for us both if you just let today be chill and dont introduce the dino-chicken-sapiens to the test environment.

1

u/Reddit-username_here Jul 21 '21

Ummm, I'm sorry, but if we can do it, we're gonna do it. Just to see if it's possible.

2

u/xslugx Jul 21 '21 edited Jul 21 '21

I don’t always test my code but when I do, I do it in production! /s

→ More replies

2

u/rabbitthethinker Jul 21 '21

It's already in production, isnt it? They...they're like oversized Tribbles with claws! The goggles, they do NOTHING!

2

u/JasonDJ Jul 21 '21

Your programmers were so preoccupied with whether or not they could, they didn't stop to think if they should.

26

u/Dragoarms Jul 21 '21

My life... where half-baked code works perfectly in a sandbox and breaks as soon as I show it off...

2

u/DizzySignificance491 Jul 21 '21

Can you make a Docker instance of a laptop?

18

u/droflah Jul 21 '21

Yeeaaaahhh... I think I'm going to have to insist you create a pull request for this and let the rest of the dev team take a long hard look at it.

2

u/ancientRedDog Jul 21 '21

git push origin master —force

I’m a jedi!

14

u/MrWh1te365 Jul 21 '21

Works on your machine, great. Just deploy straight to prod.

5

u/cantadmittoposting Jul 21 '21

"This might delete our whole prod database".

"Nah, noone would be stupid enough to point a poorly secured delete function at the root folder!"

Entire prod database wiped. ... Surprised Pikachu face.

This one act play brought to you by things that actually happened at work.

3

u/fuckyouswitzerland Jul 21 '21

DBAs, please refresh prd using uat

2

u/naliedel Jul 21 '21

Add some frog DNA. What could go wrong?

2

u/ValidatingUsername Jul 21 '21

If it points to a dinosaur, has access to dinosaur functions, and returns private dinosaur secrets...

2

u/flipmcf Jul 21 '21

Deepcopy was taking too long.

1

u/Reddit-username_here Jul 21 '21

Dude, it's got billions of years to copy, give it a little time, Jesus.

2

u/erlend65 Jul 21 '21

You're about to revolutionize the chicken sandwich as we know it.

1

u/Reddit-username_here Jul 21 '21

"chicken burger"

2

u/bruhred Jul 21 '21 edited Jul 21 '21

pub fn de_evolution(chicken: &Animal, humans: &Monke) -> Animal { if humans.eat_chicken { let new_chic = chicken.clone(); new_chic.type = String::from("dino"); new_chic } else { chicken } }

2

u/Adama0001 Jul 21 '21

Obviously they both expose the IDinosauria interface

2

u/CrazyJony Jul 21 '21

It shouldn’t cause bugs. It should cause dinosaurs. Or chickens.

2

u/nemisys1st Jul 21 '21

Straight to prod!

1

u/cleanRubik Jul 21 '21

Not in C and that’s the only language that matters…

This should be fun. …

1

u/AVeryHeavyBurtation Jul 21 '21

What language works like that?

1

u/keithcody Jul 21 '21

Shouldn’t

chicken = new dinosaur

Cuz of evolution.

15

u/chrstphd Jul 21 '21

return Humans.eatingChicken() ? dinosaur : chicken;

but I already fear the integration tests :-D

2

u/truevelvet Jul 21 '21

Why? It's literally the same

Also the correct python syntax is dinosaur if Humans.eatingChicken() else chicken

1

u/chrstphd Jul 21 '21

I just wrote a possible different syntax, nothing more. And probably not python since I do not write python quite often (but I should probably)

0

u/truevelvet Jul 21 '21

Yup it's definitely not python, I just told you

I was asking why you fear the integration tests but maybe that wasn't related to your code

3

u/chrstphd Jul 21 '21

Sorry, it was a loose try about the fact the integration tests based on "regular" chicken will probably raise some funny results around Butcher.class, MealPackage.class, ChickenWings.class...

;-)

1

u/[deleted] Jul 21 '21

His is c# and maybe java but it could be different in java I'm not sure

1

u/truevelvet Jul 21 '21

Yup that syntax is the same in a lot of languages

Java and javascript share it too

1

u/rockrocka Jul 21 '21

That's the C version

condition ? value_if_true : value_if_false

1

u/chrstphd Jul 21 '21

My example was the Java rendition that picks the "Elvis" operator from C, indeed.

1

u/My_name_is_Chalula Jul 21 '21

Did this animal survive?

8

u/Reddit-username_here Jul 21 '21

Lol, indeed!

4

u/the_real_w00zi Jul 21 '21

Lol, indubitably!

2

u/LeEliteChicken Jul 21 '21
de_evolution = lambda chicken: dinosaur if Humans.eatingChicken() else chicken

de_evolution = lambda chicken: (chicken, dinosaur)[Humans.eatingChicken()]

2

u/Carl_Bravery_Sagan Jul 21 '21 edited Jul 21 '21

Oh god that second one is dirty. And also only works if eatingChicken() returns 1 for True

1

u/LeEliteChicken Jul 21 '21

Oh yeah, hadn't considered that eatingChicken may be returning truthy/falsy values instead of True and False.

2

u/betyouwilldownvoteme Jul 21 '21

Too long :)

def de-evolution(chicken): return (Humans.eatingChicken())?dinosaur:chicken

2

u/Hemi_Blue Jul 21 '21

“Your Coders Were So Preoccupied With Whether Or Not They Could, They Didn’t Stop To Think If They Should.”

https://screenrant.com/memorable-quotes-jurassic-park-franchise/

2

u/szpaceSZ Jul 21 '21

dinosaur out of scope

1

u/Reddit-username_here Jul 21 '21

Because they're extinct, duh.

2

u/RobuxMaster Jul 21 '21

def eatingChicken():

if animal == chicken:

eat(animal)

elif animal == dinosaur:

eat(animal)

return

1

u/mikeluby Jul 21 '21 edited Jul 21 '21
from Classification import Dinosaur


 def de_evolution(chicken: Chicken, humans: Humans):
    if humans.eatingChicken():
        chicken = Dinosaur()
    return chicken

Function names should be lowercase, with words separated by underscores as necessary to improve readability. https://www.python.org/dev/peps/pep-0008/#id45

Decoupling the function to the global Humans object through dependency injection

:D

1

u/xeirxes Jul 21 '21

Unexpected character in Line 1: “-“

1

u/Funkit Jul 21 '21

Nonono you see you don’t edit old code to be better, you just add a shitload of comments like

//I know this sucks but fuck it no time

1

u/_Idk_my_name__ Jul 21 '21

Lua time

If HumansEatChicken() == true then chicken = dinosaur end return chicken

1

u/Kage_Oni Jul 21 '21
10 PRINT "Hello Chicken"

1

u/WalkingPlaces Jul 21 '21

def de-evolution(chicken): return dinosaur if Humans.eatingChicken() else chicken

1

u/aarontbarratt Jul 21 '21
Let chicken = dinosaur

1

u/valkenar Jul 21 '21
def devolve(chicken):
  return dinosaur if Humans.eatingChicken() else chicken

1

u/donnadulcinea Jul 21 '21

I'd add some Elvis operator

def de-evolution(chicken):
    return Humans.eatingChicken()?
       dinosaur:chicken;

1

u/thegentlecat Jul 21 '21
def deEvolution(chicken):
    return Humans.eatingChicken()
        ? dinosaur : chicken

1

u/BakuRetsuX Jul 21 '21

return dinosaur

1

u/McBraas Jul 21 '21

What does the return command mean?

1

u/toolazytofinishmyw Jul 21 '21

you shouldn’t be mutating your input

1

u/KillerBoi935 Jul 21 '21

a yes, coder humor

1

u/tea-and-chill Jul 21 '21

Let's go one more step ;)

def de-evolution(chicken): return Humans.eatingChicken() ? dinosaur : chicken

I have no idea what language this is, but I'm hoping it has ternary operator!

Ps: idk why return isn't going to second line -_-

1

u/viktorq_ Jul 21 '21

String deEvolution(){ return Humans.eatingChicken() ? “dinosaur” : “dinosaur”; }

-1

u/Zeref21 Jul 21 '21

Hey there it's FANGG and we would like to say despite the code being most optimal we regret to inform you that you were not selected because a binary tree was not inverted in this

0

u/flyineko Jul 21 '21
def de-evolution(chicken):  
    return dinosaur if Humans.eatingChicken() else chicken

2

u/sniper_cze Jul 21 '21

To be honest I hate this syntax, I have problems with reading it properly...

0

u/flyineko Jul 21 '21

I just put it in my code to annoy my teammates. There is much more about python that constantly tips me off, so the syntax isn't even that bad.

0

u/a_counterfactual Jul 21 '21

Should have been a lambda.

0

u/Deduction_power Jul 21 '21

The other guy's syntax is correct. He is using the proper if-else syntax. Your syntax will return an error.

1

u/awwyeahbb Jul 21 '21

Your syntax will return an error.

It won't raise an error in Python

0

u/Happy-Adhesiveness-3 Jul 21 '21

Too complicated :)

(chicken) -> {
    if (Humans.eatingChicken()) {return dinosaur;}
    return chicken;
}

0

u/radiantyellow Jul 21 '21

still too complication

def de-evolution(chicken):
    ## what happened to the chicken? doesnt matter
    return dinosaur

42

u/cmabar Jul 21 '21

Null Pointer Error: Value “dinosaur” Not Defined.

14

u/Antebios Jul 21 '21

If you let me create a DevOps CI/CD Pipeline I would have run Unit Tests, Lint tests, Code Analysis, and then Static Analysis tests. Then created an automated deployment process that would have done a smoke-test right after a deployment, and done automated QA Tests in the test environment. And then created Docker Container images and automated those test and releases as well. And finally a safe Production release with rollback available just in case. Jurassic Park would not have fucked up if they had me and my DevOps skills.

4

u/HenceTheTrapture Jul 21 '21

Well aktschually that's a NameError

3

u/cmabar Jul 21 '21

Dang you’re right, been a while since I’ve used python!

7

u/Known_Gazelle_4745 Jul 21 '21

is this python?

8

u/Reddit-username_here Jul 21 '21

Yes.

3

u/TankorSmash Jul 21 '21

can't have dashes in names though

2

u/Reddit-username_here Jul 21 '21

How do you figure‽ You can see it's right there in the name!

5

u/band0fthehawk Jul 21 '21

Undefined variable: dinosaur ;)

1

u/Reddit-username_here Jul 21 '21

Throw a 'global' in there somewhere or something!

14

u/TannedCroissant Jul 21 '21

Did you get that code from an old thread, preserved on SapExchange?

20

u/Reddit-username_here Jul 21 '21

Nah GitHub Copilot wrote it.

2

u/BaconWithBaking Jul 21 '21

probably shouldn't have camel cased that method name, ey?

Is this considered bad practice?

1

u/Reddit-username_here Jul 21 '21

Seems most Python doesn't use camel case. As someone else mentioned, using snake case can actually be important in some scenarios.

2

u/UwUniversalist Jul 21 '21

How do you do a full code box mate?

I know ` can do it but can't do full box.

this

1

u/Reddit-username_here Jul 21 '21

Put 4 spaces at the beginning of each line, then if you need to indent a line, you'd add 4 more spaces to that line, etc.

2

u/UwUniversalist Jul 21 '21
like this
or how
 Oh wow thanks a ton.

2

u/TeomanK0 Jul 21 '21

Sorry idk much about coding. Is it C language?

3

u/Reddit-username_here Jul 21 '21

Nah this was bad Python lol.

2

u/ShitForCereal Jul 21 '21

using EarthEngine;

public Class Chicken: MonoBehaviour { private bool chickenBeingAte = false;

void Update() { If (chickenBeingAte){ EvolveToDino(); } }

2

u/LostInDinosaurWorld Jul 21 '21

Code... Uh... Finds a way

2

u/0x582 Jul 21 '21

Looks like someone just completed intro to python

1

u/Reddit-username_here Jul 21 '21

Nah, never had any Python courses. Just C++, Java, and then did some stuff with Assembly, Lisp, Haskell, Lua, Io, Scala, and a few others I can't remember right now. But interestingly nothing in Python.

2

u/smiling_in_thedark Jul 21 '21

now do it like yandere dev

2

u/by_the_gaslight Jul 21 '21

Except this is more like evolution than de-evolution IMO.

This chicken is going to win life.

2

u/CelibateCarl Jul 21 '21

Pfft, the true secret lies within the math!

If e = meal and d = (drumstick x 2)

e=d2

2

u/[deleted] Jul 21 '21

Maybe I’m just a cynic, but I can’t help but cringe when I stumble upon comments like these as it makes me think the poster is in the midst of their CS-101 course. Screams “try hard” to me, but then again who am I? FYI you cannot use hyphens (or any other arithmetic/concatenation chars) in variable names in Python, will throw syntax error

2

u/Carl_Bravery_Sagan Jul 21 '21
from species.predation import eats
from species import Human, Chicken, Dinosaur

lambda devolve: Dinosaur() if eats(Human, Chicken) else Chicken()

2

u/zoicyte Jul 21 '21

Arise, chicken!

2

u/[deleted] Jul 21 '21

[deleted]

4

u/Reddit-username_here Jul 21 '21

I started out on C++, I just can't break the camel case habit.

3

u/SirLich Jul 21 '21

While I'm not going to attack you for picking a naming style that makes you happy, I would argue that abiding by snake_case in python is more than just a style issue.

Underscores in python are very important, and communicate information, both to future-readers, as well as intelisense, autodocs, and even the interpretor.

A few examples: _foo is protected __foo is private

__init__ is a constructor.

_ is an unused index

While I suppose you can justify doing something like __myPrivateVariable, it feels like you are fighting against python to do this.

If it makes you feel better, you can use PascalCase for classes! RedditComment.likes or RedditComment.karma_score for example.

The snake_case attributes make it stand out nicely from the clases, at least for me.

1

u/Reddit-username_here Jul 21 '21

All fair! My experience with Python is on the slimmer side, but I'm helping someone with some Python code they started, so it was the first language that came to my head when I saw that comment.

Thanks for the info! If I ever use Python professionally, I'll definitely need to do some research.

-1

u/n8sbug Jul 21 '21

So that's why evolution is slow as fuck...

-1

u/AbbaNyars Jul 21 '21

is that a SQL joke?!! yeah!!

4

u/Reddit-username_here Jul 21 '21
SELECT * FROM thread T WHERE T.comment like "%SQL joke%";  

OK query returned 1 results

5

u/midsizedopossum Jul 21 '21

No it isn't. What part looked like SQL to you?

1

u/AbbaNyars Jul 21 '21

Oh. I'm dumb. Withdrawn.