Crell,
@Crell@phpc.social avatar

No, , this really is a gotcha, and a stupid one at that.

https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments

bobmagicii,
@bobmagicii@phpc.social avatar

@Crell the section titled "What You Should Do Instead" i would have written completely different and also ended the article.

maxalmonte14,
@maxalmonte14@indiehackers.social avatar

@Crell so, basically they're making every single argument to be passed by reference? Yikes. I imagine this will break millions of lines of existing code.

Crell,
@Crell@phpc.social avatar

@maxalmonte14 It's more that all default arguments are function-static. Which... holy crap, that's dumb.

(This is apparently a long-standing feature of Python, not something new. I only just learned of it.)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • python
  • ngwrru68w68
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • megavids
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • provamag3
  • JUstTest
  • All magazines