Not true, I bitch about them more than ever
- 0 Posts
- 20 Comments
true, and i can’t think of a legitimate case where it would have tripped me up. but if someone, a novice perhaps, wrote
def some_func(foo, bar=[1, 2, 3]): bar.reverse() # for whatever reason print(bar) some_func('hello') # output [3,2,1] some_func('hello') # output [1,2,3]
i think they would be within their rights to be surprised that calling this function twice has different results. that’s what i was surprised by; it feels like bar would be re initialised each time with a scope of the function but apparenty not
Python item 1
Mutable default arguments don’t get re-initialized with each function call.
got an audible wtf from me… Been using python for years, totally unaware.
FourPacketsOfPeanuts@lemmy.worldto Programmer Humor@lemmy.ml•Some poor soul earning his stripes at Spotify today.8·6 months agoThe “internal business tool” was a well known industry wide product that I had experience in. I should have known that changing an email address in any environment caused that new email address to be notified. It was my fault yes
FourPacketsOfPeanuts@lemmy.worldto Programmer Humor@lemmy.ml•Some poor soul earning his stripes at Spotify today.69·6 months agoMy first week at a major fund company I was assigned to an internal business tool used by thousands. I noticed all the company email addresses in the sandbox weren’t correct, so I ran a script to correct them. Cue a call from C-level to my boss asking why he got a “email changed notification”. Followed by another… And another… And another…
I went out to lunch
Programmers in the next universe iteration: deep sigh
tine dilation
Holds up fork and squints at it
Play Game Dev Tycoon half asleep, cover all bases
FourPacketsOfPeanuts@lemmy.worldto Programmer Humor@lemmy.ml•Accidentally bought Network Switch instead of Nintendo Switch9·7 months agoI asked Alexa to order one in for me and my Indigo Witch just arrived…
FourPacketsOfPeanuts@lemmy.worldto Linux@lemmy.ml•Which graphical system utlities you miss on Linux?2·7 months agoI didn’t unfortunately :/
FourPacketsOfPeanuts@lemmy.worldto Linux@lemmy.ml•Which graphical system utlities you miss on Linux?3·7 months agoDebian + GNOME. I’m extremely new to Linux so excuse my ignorance. I searched around the topic a while finding some commands that didn’t work and others having the same issue. If you know different that would be much appreciated!
FourPacketsOfPeanuts@lemmy.worldto Linux@lemmy.ml•Which graphical system utlities you miss on Linux?71·7 months agoIt seems impossible to set display scaling from the command line. Anything that fixes that would be nice.
FourPacketsOfPeanuts@lemmy.worldto Programmer Humor@lemmy.ml•Using comments as arguments in python.341·8 months agoAnakin:
FourPacketsOfPeanuts@lemmy.worldto Programmer Humor@lemmy.ml•Using comments as arguments in python.46·8 months agoEvery day further from god’s light etc…
FourPacketsOfPeanuts@lemmy.worldto Programmer Humor@lemmy.ml•Real Programmers Implement Functions On Top Of Classes4·8 months agoAmazing, lol
“somehow RIF returned…”
FourPacketsOfPeanuts@lemmy.worldto Programmer Humor@lemmy.ml•Oh boy what a beautiful regex. I'm sure it does something logical and easy to understand.1·8 months agoI’m I the only one who pronounces regex with a soft g? Hard g feels so clunky
I follow the 80/20 rule recursively. as soon as I’ve gotten 80% of the way there for 20% effort I immediately stop, and start a brand new project for the remaining 20%. Bam! 96% complete for only 24% effort.
taps forehead
Remember to throw in “=” at the start just to toy with the poor sap who has to manipulate the results in excel
Oh it won’t end