[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: si_prefix_python.png (321 KB, 1632x1912)
321 KB
321 KB PNG
>>
File: 1695601198167715.jpg (1.28 MB, 2480x2480)
1.28 MB
1.28 MB JPG
Your professor is gonna tell you to comment your code
>>
>>101554267
python is a write only language
>>
>>101554267
That's what AI is for.
>>
>>101554545
code commenting is overrated - only comment weird things

>>101554267
you should specify types in function headers:
def foo(n: int) -> float:
return n * 1.23
>>
>>101554617
absolute moron
>>
>>101554267
Looks mostly fine to me honestly. But if you want nitpicks:
>use class syntax for your namedtuples
>write things out instead of doing this splitting and ranges shit. it's not much boilerplate at all
>consider using a list of tuples instead of tuple of lists
>rename Prefix -> Suffix. these are not prefixes
>rename basemap -> suffixes, logn -> log_n, logp -> log_p, logscale -> exponent
>consider binary=True instead of base=2. it's not like you're ever gonna generalize beyond 2 and 10. these are the only scales in common use
>I would ditch alignment completely, but that's just personal preference
>>
>>101554267
>python
0/10
>>
>>101554267
your Prefix namedtuple is unused
>>
>>101555376
Cope it's pretty good for ctrl + f'ing to stuff desu.
>>
>>101554267
imports are not sorted, automatic fail
>>
>>101555511
>>rename Prefix -> Suffix. these are not prefixes
Actually scratch that. I've re-read the code and this was a brain fart on my part. I was thinking about the number instead of the unit after the prefix.
>>
>>101554267
What is this? it looks disgusting. Not your code, the language.
>>
>>101555549
*quack*, *quack*
>>
>>101555633
?
>>
>>101554267
ynwba/w
>>
>>101555522
that was supposed to be a feature to expand k to Kilo, M to mega etc. I didn't have enough time left to flesh it out, so I submitted the code as is.
>>
>>101555519
>>101555549
>this is what retards on /g/ actually believe
>>
>>101555533
thats what identifiers are for, unironically
>>
P.S. >>101555511
Also, you probably meant to instantiate ValueError with a message, rather than raise the class. And Prefix is unused.
>>
>>101555533
t.
i = 1 # Set i to 1.
while condition: # Loop as long as condition is true.
my_method(i) # Call my_method with i as the first and only parameter.
>>
>>101555555
>>
>>101555713
I'm sorry, it's vile. Why would you use it in a world where scheme and lua exist?
>>
>>101555511
>I would ditch alignment completely, but that's just personal preference
please explain
>>
>>101554545
>Your professor is gonna tell you to comment your code
This! My jeet professors had me comment my fucking comments on top of every single variable.
>>
>>101554545
This. I ain't reading shit without comments.
>>
>>101554267
which font? looks really nice
>>
You raised event outside try/catch. Yes, this works, but bubbling when dealing with larger projects won't tolerate this well. Async and generators come to mind. If you passed base 3 or None into the function won't raise a ValueError like it should.

I assume he gave the log thing. Python can't floating point.
bisect(list(range(0, 27, 3)), log(1000, 10)) returns 1.
Feels like the correct solution should be 1000 = 1K and not 1000. Especially if 1001 is going to return 1K with your sig figs.

using Scale and scale is annoying to me, but I am sure nobody else would care.
>>
File: mplus.png (131 KB, 1039x908)
131 KB
131 KB PNG
>>101556212
https://mplusfonts.github.io/
>>
>>101554267
only if you tell me what you used to produce this image
>>
>>101555511
>>101556439
thanks. now I can see myself going from a B+ to C-
>>
>>101556500
https://marketplace.visualstudio.com/items?itemName=pnp.polacode
>>
>>101555817
why the fuck do you retards like that language so much? its only data structure is a trooned out hash table
>>
>>101556522
I used to TA a first year programming class. The absolute dog shit that came through was shocking. If you get anything less that a B+ I am willing to call your prof myself. Probably a bad idea to post your prof's number on 4chan, but here we are.

If your code review just has smells then you are winning.
>>
>>101554267
absolutely unreadable niggerlicious tryhard code
why the fuck is it so hard for you to write
["Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Yi", "Zi"]
? it took me less than 30 seconds to type that out manually, and it's clear it's a list and not some freshman trying to seem smart by adding an unnecessary layer of abstraction on top of his puke.
your
split(sep=" ")
shit is dumb as fuck anyway, you don't even need to specify the separator for this to work, and your trailing whitespace is unnecessary too.

>>101555511 is right, you want to use a normal dataclass

and add some error handling you dumb fuck
>>
>>101556545
thx
looks good;)
>>
>>101554267
>>101556687
>absolutely unreadable niggerlicious tryhard code
I concur.
Here's mine:
def DERP_LabelFileSize(iSize):
for unit in [" B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB"]:
if abs(iSize) < 1024.0:
return f"{iSize:5.4g} {unit}"
iSize /= 1024.0
return f"{iSize:5.4g} YiB"

Less, features, yes, but any idiot can immediately understand it, eventhose who don't use Python on a regular basis.
>>
File: ipython.png (21 KB, 865x197)
21 KB
21 KB PNG
>>101556687
without the
sep=" "
 the first element in the list is missing (empty string/prefix). I don't know why this happens though.
>>
>>101555817
What? Lua is one of the worst languages I've ever used. Almost everything about its design is completely retarded. The fact that the "people" of /g/ shill it over Python is absolute proof that they are nocoder morons who pick languages based on stereotypes rather than their technical properties.
>>
>>101557020
messed it up. what I meant to say:

"without the sep=" " the first element in the list is missing (empty string/prefix). I don't know why this happens though."
>>
>>101556687
get on my level scrub. Took me 30 seconds too and mine solves the problem. It is also unreadable trash. Really proud of your typing skill friend. Now do fizzbuzz to 10 without a loop/recursion.
>>> "4i".translate(str.maketrans("012345678", " KMGTPEYZ"))
'Ti'
>>> "5i".translate(str.maketrans("012345678", " KMGTPEYZ"))
'Pi'
>>> "6i".translate(str.maketrans("012345678", " KMGTPEYZ"))
'Ei'


>>101556858
1024 and not 1000. You must be the guy who says the assignment is unfair after losing marks, EVERY time.
>>
>>101557020
>>101557075
It might be doing an internal strip() if you don't specifiy a separator, you need to check the reference manual.
This is the "spooky" shit you gotta be aware of in Python.
An experienced programmer would probably do " Ki Mi..".strip().split(...) intuitively, to avoid "spooky" behaviour from even occuring.
>>
Terry was right
>>
>>101557103
>1024 and not 1000. You must be the guy who says the assignment is unfair after losing marks, EVERY time.
Actually both, and I actually work as a programmer, so I don't need to prove anything.
Oh, and I actually did say it has less features (OP's has an arbitrary base), and anyone non-retarded can also immediately see my code is excellently suited to expand.
I've, so far, only required 2^10 prefixes, because my code is actually used IRL.
Dunning-Kruger, you may want to Google it.
>>
File: caught_me_slipping.jpg (60 KB, 522x440)
60 KB
60 KB JPG
>>101557103
>str.maketrans
>make
>trans
>>
>>101557151
>assignment
Also, every "IT test" I actually do has me indeed arguing with the "teachers."
They either become immediately aware that they don't know shit or a massacre ensues (it was always the former, so far).
t. thought he didn't know shit and went to vocational training
>>
>>101557151
>Actually both, and I actually work as a programmer, so I don't need to prove anything.
see
>>101556858
it is where you tried to flex on a first year assignment and failed.

>>101557181
I am wearing my programming socks today.
>>
>>101557218
Oh come one now, you're just a shitposter.
Cheers.
>>
>>101557213
>t. thought he didn't know shit
Prolly the life-story of every second self-taught out there.
The real self-taughts, the ones who learned all that shit as kids, just so they can mod their retarded computer games.
The ones who learn Python as a side-effect, using it just to script building the mod together.

We are, on average, the most competent, maybe society will stop thinking the exact opposite some day.
Because that dude, who obviously was a jock in high school, obviously just did CS because he thought it was a safe job.

I wasted five years of my life thinking I was not 1337, don't let it happen to you, if you were like me, you will be surprised just how retarded the average person actually is.
>>
Bad error handling, this doesn't even need to be fallible just return the number with None for the prefix. It's also really dumb building static data at startup by string parsing, it's slow and pointless. It would also make more sense to write a unit test than a docstring comment that shows expected output
>>
>>101557261
>Oh come one now, you're just a shitposter.
accurate.
I don't like people dunking on undergrads. Calling OP a tryhard/idiot was out of line. If he is going to claim superiority he needs to bring it. I am still waiting for him to write anything of interest. I am still waiting for him to figure out that " " is not equivalent to the default of removing whitespace. https://docs.python.org/3/library/stdtypes.html
>>
>>101557398
>I wasted five years of my life thinking I was not 1337, don't let it happen to you, if you were like me, you will be surprised just how retarded the average person actually is.
98% of the people reading this are in the latter category, and you will invariably put yourself there as well, sigh.. :)
>>
>>101557422
>accurate.
>I don't like people dunking on undergrads. Calling OP a tryhard/idiot was out of line
That's fair.
Imagine he just gets praise, and starts coding like this in the job, because he thinks it's good.

OP is a smart and wiseass, and wants to impress their peers/professors.
I wouldn't be impressed, I'd say
>Yeah, Anon, very nice, it seems to work, but I hate you for having to read that all, and either I'm forced to read it now or I will neglect my job of proof-reading and just wink it through, causing possibly planes to fall out of the sky one day

Your type is sometimes worse than the actual evil ones, because at least they do not think of themselves as being on a righteous crusade.
>>
>>101555899
Alignment example:
some_example_function_name(some_other_function(argument_1),
argument_2 + some_math_thing)

Indentation example:
some_example_function_name(
some_other_function(argument_1),
argument_2 + some_math_thing
)

I used to like code alignment as a younger programmer, but at some point I realized that it doesn't actually add readability, it just adds extra diff churn and extra work when refactoring. So I avoid it completely now. Completely up to personal preference though, I know some programmers who are skilled and still like it.
>>
>>101554267
Is this screenshot from macOS?
>>
>>101556522
kekked
>>
File: 09h00zjesvt61.jpg (15 KB, 400x400)
15 KB
15 KB JPG
>>101557213
>Also, every "IT test" I actually do has me indeed arguing with the "teachers."
>They either become immediately aware that they don't know shit or a massacre ensues (it was always the former, so far).
>>
>>101557399
Nah, I think it's usually better to fail with an error than to return None. Not always, but a good default.
Time for string parsing at startup is literally a non-issue, but I do agree this is just overcomplicating things. Just hardcode a list, not that hard to press " a couple times.
>>
>>101557978
I shit you not, it was a fucking joke.
I'm EFL in Germany and I had to take English IT classes.
I was thinking: I should be standing there.

That's just the most egregious example, only in business classes was I on almost equal footing to the teacher, he was 40 years my senior and worked for banks and shit and was doing this as fun after retiring, but as the right-hand man for the boss at my former job, I knew a thing or two as well.

I quit college and went to work, and after I quit, all I have is basically a Baccalauréat/Abitur, so I thought I wasn't worth anything... hence me ending up in those IT classes.
>>
>>101558209
*I basically ended up started an own company, then covid came, then doing business as a "rabid anti-vaxxer" [your words] was pretty much impossible, so I've been NEETing around since.

I tried to get a job two years ago, applied four times, got three replies, three interviews, two offers (first one wanted to take me on the spot), ended up doing something for three days, before quitting again, because, no... I just can't deal with normies anymore.

Not sure if I'm going to be NEETing to the day I die, let's see.
>inb4
Embedded developer.
>>
>>101554267
Stop trying to be clever. Write simple code that can be reasoned about as locally as possible.

from math import log

SI_PREFIX = ('', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')


def prefix(n: int, /, *, si_units: bool = True) -> tuple[str, float]:
if n == 0:
return '', 0.0

base = 1000 if si_units else 1024
m = min(
int(log(abs(n), base)),
len(SI_PREFIX) - 1,
)
n /= base ** m

unit = SI_PREFIX[m]
if m and not si_units:
# upper() handles case difference between "KiB" and "kB".
unit = unit.upper() + 'i'

return unit, n


Also, zetta is smaller than yotta.
>>
>>101558356
>I just can't deal with normies anymore.
>Not sure if I'm going to be NEETing to the day I die
I mean, these two are kinda correlated, so I don't have a guilty conscience about it, either.
I am unironically too high IQ to get along with most people, I cannot imagine what is going on in their heads and vice-versa.
You have to be extremely cereberal when talking with me, or, at least, not get offended if I interpret highly emotional things in a very cereberal manner, and then react in a way you might consider to be 'rude.'
>>
>>101558647
*Too many expect me to be on their emotional side without delivering a logical basis for it.
I have to learn how to deal with it.
Sorry for hijacking your thread, OP, rubber duck debugging, cheers.
>>
>>101557103
>asks for criticism
>gets criticism
>NOOO WHY U LE HECKING DO THAT!!!!
if you don't want your midwit cope code judged on the internet, don't post it in the first place.
>>
>>101557422
>>101557477
I am seriously failing to understand the point of these posts. Are you rambling after getting high or are you 70? You're making no sense.
>>
>>101554267
>bisecting on an index that can be calculated with ONE fucking integer division
no wonder you're trying to seem smarter than you are, it's because you're clinically retarded
>>
>>101558647
>>101558732
>i am so le high IQ i am too dumb to construct my own theory of mind
cool cope, redditard
kill yourself
>>
>>101554617
there was a time when it was the best language
>>
>>101558647
>>101558732
That's not le high IQ, that's just undiagnosed autism. Your false sense of superiority is probably not as well hidden as you think it is, and it probably prevents you from establishing deeper bonds with people.

>>101558356
May apply to you too, I think. Lay off the 4chan for a moment and try to be more understanding of people, I'm sure your shit annoys them sometimes too.
>>
>>101558807
Bisect is fine here.
>>
>>101558557
>>> prefix(.00000000000000000000001)
('M', 0.01)
>>
>>101555817
Python is like Lua but actually good
>>
>>101559295
>whitespace
no
>>
>>101559340
Focusing on syntax over semantics is a trait of beginners who suck at programming. If you were smart and actually programmed in all three languages, you would know that Python and Scheme are actually similar in many ways below the surface level. One would have to be utterly retarded to love one but hate the other.
>>
>>101559340
>>101559369
On the other hand, Lua has different semantics that make it much harder to debug programs than in Python or Scheme, for no good reason. It belongs on the trash heap of bad languages together with Perl and old PHP.
>>
>>101559209
Says "int", doesn't it?
>>
>>101559369
>>101559401
I don't care how much cope you produce, writing and especially reading with whitespace involved is like pulling teeth. I can very easily read a Scheme program, I can easily read a Lua program, I'd rather get hit with a hammer than read a Python program.
>>
>>101559340
>>101559454

Do you not indent your code?
>>
>>101559454
Ah, you are legitimately retarded then or just started programming this year. Real programmers know that you can get used to pretty much any syntax in two weeks flat. Reading your cope is like reading someone bitching about parentheses in Lisp, honestly.
Syntax is just a coat of paint over semantics. Anyone who thinks it's the most important think about a language is a beginner and his opinion should be discarded. Actual competent people consider things like the type system and module system of a language more important, as they affect the experience of working a large program much more.
>>
>>101559454
>oh nooooooooooooo this code has indentation! it is over
skill issue 100%
>>
>>101559540
I don't know how many times I have to repeat myself, I can't read the whitespace. I won't even try.
>>101559477
>>101559573
I'd rather decide how to do it myself rather than the interpreter, thanks.
>>
>>101559596
>I can't read the whitespace. I won't even try.
Oh no, not the whitespace! Anything but the whitespace! Fear has overtaken me and my brain can't cope with the whitespace! I can only read code where every line starts at column 0, and no I am not retarded okay?!
>>
>>101558753
follow the thread friend. I didn't ask for criticism and I was giving a tryhard example mocking the asshat. I criticized myself in that post, so maybe I hurt my own feelings.
>>
>>101558830
>theory of mind
Yes, there are days when I think or feel like I'm fucking ugly or filthy, and some women apparently don't, and some might think I'm being rejective, if I'm really actually just ashamed of being a mess in that moment.
But the odds are definitely in favor the women will take it personally.

Anyways: Who, here, failed to construct a theory of mind?
And why does everybody believe it is me?
She is equally at fault for failing to consider what be on my mind.
She'll probably go home thinking she's ugly and more damage is probably done that way than if I keep it together for a second.
But it is, technically and before the court of divine law, not my obligation to entertain that.

>>101559055
>That's not le high IQ, that's just undiagnosed autism
No, I can do normie, it's just fucking exhausting and I hate it.
I rage (mostly internally, hopefully) if I have to, while being NEET gives me peace, and this is (currently, I guess, idk) worth more than anything in the world to me.
>>
>>101560143
>I can do normie, it's just fucking exhausting and I hate it.
Yes, exactly.
>>
File: whitespace phobia.png (1.25 MB, 2000x1000)
1.25 MB
1.25 MB PNG
>>101559705
>>
>>101558015
But it's not an error. The caller doesn't need a reason to know, they simply passed a perfectly valid input that doesn't map to an output.
>>
>>101560238
Doesn't seem that exhausting for the others, I mean, why should it be, it's just mindless blabble.

But I start thinking like this, and I have "verinnerlicht" my superiority (and you think that's normal and "normal" sense of superiority), because I think of them as nothing more than sheep baaaah-ing on a field.
I'm not ready for that; in fact, it is illegal in this country:
>Die Würde des Menschen ist unantastbar.
I'm not allowed from getting in touch with reality, huh.
Wow.
>>
>>101560319
>Die Würde des Menschen ist unantastbar.
I.e. you're going to have to tell me you're dumb, else I am forced to assume you understand nuclear physics, because I cannot assume you are too dumb for that, can I now?
>>
File: 2024-07-05_DMR.png (26 KB, 608x115)
26 KB
26 KB PNG
>>101560354
*The entire country is autistic, to be fair.
>>
>>101560279
Hmm, I see your point. Now I'm not sure which way is better. Depends on the surrounding code I guess.

>>101560319
>Doesn't seem that exhausting for the others
Oh, I know.
People who talk like you do are literally never as smart as they think they are. You've just taken your autistic traits as a proof of your intelligence, dismissing people who are both intelligent and into normie stuff like small talk. Ironically, an idea you probably got from pop culture - most writers don't know how to depict characters who are both conventionally intelligent and socially normal, so they fall back on cliches like Rain Man and Sherlock Holmes. This then got reinforced by hanging out with the retarded teenagers of 4chan, who just post the edgiest thing that comes to mind because they think it makes them look cool rather than immature. Until it was a self-reinforcing loop where you preemptively do stuff that makes people reject you, which you take as a further sign of being some kind of misunderstood genius meme. I bet you identify with the movie Joker too.
I know this because I was just like you when I was a teen. You can either drop the cope and the superiority complex, or sink deeper into being an abrasive loner that nobody wants to know. Your choice.
>>
>>101560669
>injecting political shit into programming thread
you should kill yourself
>>
>python
you get an F
>>
>>101560580
>I know this because I was just like you when I was a teen. You can either drop the cope and the superiority complex, or sink deeper into being an abrasive loner that nobody wants to know. Your choice.
I was like what you are now as a teen, lol.
Glad you're happy.
I feel you feel attacked by me, I need not say more, I think.
Cheers!
>>
>>101561193
*Wait, I just wanna add, I believed people like >>101560580 two or three times before, and everbody was worse off with me trying to talk myself into believing I'm just like everybody else.
People expect me to know that I am special, that's, like, even the minimum in their eyes.

You just cannot imagine me, I guess.
I think it's logical I am where I am (or not where I shouldn't be).
I did not make enough negative presumptions about other people and wasted some time of my life, that's my bad.
>>
>>101559075
>Bisect is fine when a division and a log are enough
Learn some fucking pre-calculus holy fucking shit
>>
>>101563470
bisection algorithm is faster than the division operator in python
>>
>>101554267
lgtm
>>
>>101563578
kill yourself dunning-kruger midwit
>>
>>101558209
>>101558356
>>101558647
>>101558732
>>101560143
>>101560319
>>101560580
>>101561193
>>101561348
shut the fuck up you insufferable stuck-up autist
get psychological help
>>
>>101554617
no, that's perl
>>
>>101554267
0/10 because of gay colors
>>
>>101566065
python killed perl and ate its kids for cereal
>>
>>101565142
>get psychological help
I actually did once, it's useless.

I know what I gotta do, but where else would you be reading it from this perspective?
Nobody "cares" what my "problems" are, because in their opinion, I ain't got any.
Their conclusion is wrong, because their assumption, that I want what they want and that I got what it takes to get it, is false to begin with, and I just gotta shut up about it, because there are just too many like that.
But it does not mean I am wrong.

I really get along just fine IRL, I mean, I am content, but if I never voice my thoughts, not even here, it's likely nothing may ever change; chaos theory.

>shut the fuck up you insufferable stuck-up autist
Yes, sorry (Q.E.D.).
>>
>>101555376
code commenting is note done in real projects yes but professors have never worked on a real project so they require you to do things in a way that you would never do at a job
>>
>>101563470
>>101565120
it makes basically no difference to readability of performance, you absolute moron
both are fine
>>
>>101561193
Sorry if I hurt your feelings with yesterday's post. It came off more combative than intended, as I was sleepy and writing it very late.
>I was like what you are now as a teen
What went wrong (if you don't mind sharing)?

>>101561348
>trying to talk myself into believing I'm just like everybody else.
I wouldn't recommend believing things that are false, no. But there's also no need to go to the other extreme and make your self-imposed isolation worse by leaning into some kind of le misunderstood genius trope, probably made worse if you spend many hours per day on /g/, a website where people who fail socially and have no technical skill use edginess to cope.
It would also be mistake to dismiss normies as being dumb. I've met many people who were rather intelligent while also enjoying small talk and not wanting flaunt their intelligence, or spend their entire life in front of a computer or books. It was the clearest to me when hanging out with art people, compared to normies in business and medicine. Many art people had some thing going about how they were le quirky and misunderstood, inserting pretentious humanities jargon like "intersectionality" and "commodification" into conversations, while in reality their views were basically copy/pastes of one another. On the other hand, the turbonormies who went into medicine or business for the money had far more nuanced views of the world and more varied interests.
Also, Einstein was most likely autistic and that guy had a rich and rewarding social life. If you're so high IQ, why can't you?

>>101566177
>chaos theory
You're trying too hard to sound smart. 4chan is not movie dialogue. Dial it down a bit.
>>
>>101555376
Function names like "prefix" are pretty vague. I can't tell what OP's code does at a glance.
>>
>>101566538
>What went wrong (if you don't mind sharing)?
You're still convinced you're right.
>misunderstood genius trope
Every genius is misunderstood, they just sometimes dumb things down enough for everbody to kinda get what they're thinking, and that's when everybody realizes they're geniuses.
They might just walk around looking like you and me, or maybe not, who knows what correlation exists.
>Einstein
Counter-example: Tesla and Newton.
Again, no correlation (if you're looking for one possible one: Einstein was ruthless, Tesla and Newton both give off "couldn't hurt a fly" vibes).
>You're trying too hard to sound smart.
My nigga, I use the keyword 'Chaos Theory' (actually I just meant the Butterfly Effect; if I were tryharding, I likely would not confuse the two) to compress what I would need five sentences to explain in one or two words.
If you cannot get the gist of it from that, one might think I'm trying to sound smart, sure.

Let it die already, there aren't any tropes about me (yet), and you're trying to find one to fit me in, because it seemingly explodes your view of the world to take my words as they are.
>>
>>101568644
>You're still convinced you're right.
*You could've asked what changed.
>Counter-example
Add Perelman to the list.
Him and Diogenes are kinda my idols; I'm not as hardcore as them, but I admit both have very valid points.
>there aren't any tropes about me (yet)
If I'd do everything you ask me to, I'd end up being a Mary Sue.
And everybody secretly hates them.
>>
This thread turned to shit lmao, the aspergers tard needs to go back to r9k or reddit or whatever other shithole he crawled out of.
>>
>>101566323
>an O(log n) list bisecting algorithm has no difference in readability and performance from a O(1) logarithm
POO POO POO IN THE LOO
DON'T FUCKING REDEEM SAAR

POO POO POO IN THE LOO
BLOODY BENCHOD BASTERD!!!
>>
>>101566177
>I actually did once, it's useless.
we can tell

>>101566538
>>101568644
>>101568797
didn't read
>>
>>101568893
This thread was shit from the very beginning, and OP is a retarded undergrad who's never programmed anything worth a shit in his entire life.
>>
>>101568644
>You're still convinced you're right.
Yes. You are just like me when I was younger and more self-absorbed.

>>101568797
>I'd end up being a Mary Sue.
>And everybody secretly hates them.
Oh come on lmao. "I can't fit into society because then I would be too powerful?" Give me a break.
>>
>>101571020
>Oh come on lmao. "I can't fit into society because then I would be too powerful?" Give me a break.
Yes, how many good candidates were removed from posts because they could not be controlled.
>Yes. You are just like me when I was younger and more self-absorbed.
And you like me when I was younger.
So, which is, per se, actually a juvenile way to be?
What does that even mean?

You're a little bit more than a midwit, maybe, or a just midwit, sorry.
Are you vaxxed?
>>
File: 1664053147575296.jpg (69 KB, 512x789)
69 KB
69 KB JPG
>>101571176
>Are you vaxxed?
You see, that's where geniuses and retards meet again, and midwits fall through.
The retards are the broken clocks, meaning their behaviour is entirely up to chance, meaning midwits perform worse than random chance in choosing the correct medication.

This is all due to them not only being midwits, but monkey-see, monkey-do patterns among them.
The pleb, like I said, is operating with random chance, it does not know what it is doing, and is the baseline, midwits perform worse and actual smart people, who know they are smart and have the confidence to believe in themselves and what they think, are above that baseline.
>>
>>101571176
>Yes, how many good candidates were removed from posts because they could not be controlled.
Oh OK, so you have some persecution fantasy going on with le evil society wanting to control you and get you vaccinated. That's disappointing to hear. Do you use /pol/, by any chance?
>>
>>101569099
"Python uses a brute force O(n2) algorithm for quotients of any size."
you're in the wrong here buddy
>>
>>101571371
Well, I'll just ignore Poe's Law and presume that you are indeed just shitposting at this stage and are no longer required to entertain your posts as if you are retarded and deserve to hear what you are doing wrong.
>>
>>101571419
Oh noo, what will I do without your tremendous insight.
Be careful, if you say the wrong thing then you may get vaccinated by the secret agents who are in your walls and want to control you.
>>
>>101569178
>op is undergrad
>op isn't a seasoned programmer
checkout captain obvious over here
>>
>>101569178
Undergrads typically don't have enormous programming experience and need some hand-holding. Utterly shocking, I know.
>>
>>101571445
Ok, I'll try:
You are retarded like a monkey trying to stick its dick into a blender.

I'm not really good at insults, because everyone worth insulting, isn't worth spending time thinking about...
Ehh, whatever.
>>
>>101571479
Eh, I was just shitposting a bit because I found it genuinely funny that THIS is your grudge against society. After so many posts typing like you're a movie villain, I expected something bigger. Maybe people shot your dog and raped your sister or something. But the big reveal was that... you're still seething about vaccines in the year 2024 lmao
Anyway, looks like we're both shitposting now. Take care. Hope you don't NEET too long. It's pretty miserable after the first 6 months, speaking from experience.
>>
>>101571722
>THIS is your grudge against society
>After so many posts typing like you're a movie villain, I expected something bigger.
Goddamnit, Anon, fuck you :D
>>
>>101555376
>code commenting is not important
Niggerlicious
>>
>>101572464
beginner retard
>>
>>101555376
I think you'd change your tune on commenting if you were in a team of Saars... their comments might suck, but it goes a long way when refactoring their spaghetti
>>
File: 1693911027622.jpg (61 KB, 800x744)
61 KB
61 KB JPG
>>101557020
>>101557075
rtfm
https://docs.python.org/3/library/stdtypes.html#str.split
>>
>>101556687
>>101556858
>>101558557
Based.

>>101564788
Gigabased.

Whatever institution is teaching you to code like this, drop out of it.
>>
>>101576513
Oh god i didn't even saw that this thread became a two bitch slap-up shitshow before posting on it, i'm embarassed.
>>
>>101554267
>split(space-separated string)
what the fuck are you doing here, just construct it as a list in the first place
>>
>>101555139
>That's what AI is for.
That's why OP opened 4chan...
>>
>python
looks great sar
>>
>>101571447
>>101571452
plenty of experienced programmers who don't even have an undergrad
>>
>>101554267
wtf does it do? prefix? not a very clear function name.
>>
>>101554267
basically, would give you an F for this.

it took me like 5 minutes to figure out what that scrible does. it's converting bytes to more human readable output. And yet you chose to call this fucking function suffix?

it should be called formatBytes or something like that. Naming is most important, if you cant do that, you shouldnt be programming desu. Are we supposed to look at your fucking implementation to figure out what this is?
>>
>>101554267
IDK what your professor values, but I'd reject this change in code review. Very obscure behavior and no comments explaining why it needs to work the way it does. The simplest solution is some kind of divide-by-bytes-until-you-can't. Adding logarithms is excessive and requires you toss in even more magic numbers to make everything behave properly.

This is on top of the fact that there's a very obvious bug, namely that you don't try to validate base. Enter in a number besides 2 or 10 and your function will terminate on the first line with an unhelpful error. Functions should protect their callers from doing obviously incorrect things, and yours doesn't.

On top of all this, why go to all this trouble just to force the caller to format the string? Is adding the character B too much to ask for? Weird, weird stuff.

I can only hope all of this is because the assignment was something like "use logarithms and bisect in order to SPECIFICALLY return the PREFIX for some bytes" and not because you decided this was the best approach on your own.
>>
>>101577897
It's worse than that, even the implementation is non-obvious. Would you be able to tell whether the logscale for 10 should stop at 16 or 17 when you're just skimming the code? Or do you need to think for a moment?

And hmm, wouldn't you know it, when I write this up in a Python playground, it stops finding the right base 10 scale at P:

>1234567890.12PB
>1.02ZiB

Who ever could have guessed this would happen!?

Absolute F. Wrote code so overcomplicated that nobody in this thread even noticed that it DOESN'T FUCKING WORK!
>>
>>101578021
https://www.online-python.com/fcV9zWuw57 btw, check my work for any typos. Tried to be 100% faithful but nobody's perfect.
>>
>>101578021
>>101578028
Oh lol, now that I look at it again I fatfingered the wrong number in the 10 scale (27 -> 17). It works after all. Magic numbers are still for cocksuckers.
>>
>>101578021
whats worst, my fucking CEOs will hire that guy right out of college and I will have to deal with him lol.

already dealing with several of them, letting the codebase degrade basically. Fuck the CEOs and fuck programming.

I'll just clone the service and make a competing product at some time.
>>
what's the point of colleges nowadays if they teach that stuff, that even the most primitive AI can solve.
>>
>>101578309
multiple exponentiations per function call. rejected.
>>
>>101578185
>I'll just clone the service and make a competing product at some time.
you won't. that's why you're a wagie code monkey and not a ceo



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.