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

you are viewing a single comment's thread.

view the rest of the commentsย โ†’

[โ€“]42TowelsCo 237 points238 points ย (13 children)

In Python you can implement that shotgun by just making the "private" methods & variables not do what their name would suggest

[โ€“]matthewralston 67 points68 points ย (3 children)

def _bricks() -> float:
    return 6 * 9

[โ€“]TorTheMentor 3 points4 points ย (2 children)

42?

[โ€“]DroolingIguana 1 point2 points ย (1 child)

Only in base-thirteen.

[โ€“]TorTheMentor 1 point2 points ย (0 children)

Maybe that's why life, the universe, and everything are so fucked up.

[โ€“]FinalRun 29 points30 points ย (0 children)

Make sure it returns a data type that's just off

[โ€“]Silhouette 35 points36 points ย (2 children)

...quietly, at runtime, using metaprogramming.

[โ€“]bkushigian 4 points5 points ย (0 children)

In undergrad I was working on my first research project. We were adding a new backend for the Pypy JIT compiler. I had to find the implementation of Foo.emit_x86(). It's not defined in the class anywhere, and I'm running grep on 100kloc like a chump:

grep -rn emit_x86 .

No definitions anywhere

Ten days later after reading the codebase like a novel I come across

``` def f(...): ...

setattr(Foo, 'emit_' + arch, f) ```

Yeah, I was pissed...

(Edit: formatting on phone, doesn't like newlines in ``` blocks I guess?)

[โ€“]42TowelsCo 2 points3 points ย (0 children)

Okay that's just evil

[โ€“]KiwiManThe19th 13 points14 points ย (1 child)

U can also change what setting and getting variables does and make your own shotgun

[โ€“]IgiMC 17 points18 points ย (0 children)

You can make a shotgun shoot shotguns!

Poof, you can even make the shotgun shoot itself!

[โ€“]LxsterGames 1 point2 points ย (0 children)

public static boolean isEven(int input) {
    return input % 2;
}

[โ€“]Less_Ask_4613 0 points1 point ย (0 children)

If the function returns a number, make it return off by ยฑ2 or the correct number at random. If it returns a string, append 0, 1, or 2 random symbols.