it's an interface [which is why i called it standard library], so when i write from random import randint as rand, in the game logic you can write ~rand 1 9 and it will give you a random number between 1 and 9 the same way randint(1, 9) would
from random import randint as rand1
class A:
from random import randint as rand2
instance = A()
rand1(1, 2)
rand2(1, 2) # Throws an exception "rand2 is not defined"
instance.rand2(1, 2)
the problem here is that you're not the developer making the code. I mean if you are thinking "Imma get that value with this key" you would go immediately for sessions[key]. here, you are reading another person's code (OP's). in your mind the code makes sense but you don't have a clear picture of what OP actually wants with the code.
nice code OP! probably a result of editing a pasted code
Ugh, it's so shitty when you pay for that kind of help. Been coding for over a decade, but I wasn't comfortable with Unity yet at the time, so I paid someone to write me an animation progression system that would integrate into Unity's built in animation system but would be easy to apply to a bunch of assets.
I got an over 200 line disaster of almost exclusively if/else statements and booleans, and it only worked about 30% of the time. Paid $250 for that, it took them a week, and they stated that they probably should've charged more but they would "keep their word." Once I got cozy with Unity I rewrote it myself in less than an hour using arrays, was only 20 something lines of code, worked like a charm. Ridiculous.
66
u/oderjunks Aug 02 '21
author: me
source: mafia-redux/mods/stdlib.py, line 114
43
u/Sanduhr32 Aug 02 '21
That's a good one OP haha. Definitely the best map implementation I have seen so far ;)
24
u/Legendary-69420 Aug 02 '21
Am I just too addicted to writing one-liners or is there no problem?
5
u/elder_plinius Aug 02 '21
This is so awful it’s kind of beautiful
32
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Aug 02 '21
Image Transcription: Code
[Thanks to OP for providing a link to the source in this comment. I have also placed it here for ease of access.]
I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
9
u/DrMaxwellEdison Aug 03 '21
Triggered
At least you realized your own error. Contractor who wrote mine deployed the same pattern a dozen times.
2
u/infamous_redditor Aug 08 '21
Damn I've been coding wrong this entire time