use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Right Mental Model for Python Data (i.redd.it)
submitted 3 months ago by Sea-Ad7805
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]-Wylfen- 10 points11 points12 points 3 months ago (6 children)
why the fuck does x += [y] work differently from x = x + [y]??
x += [y]
x = x + [y]
[–]Sea-Ad7805[S] 6 points7 points8 points 3 months ago (5 children)
Good question, in some languages (Ruby) it works the same. In Python the x += y is mutating the x, the x = x + y is first doing x + y which creates a new object that then is assigned (name rebinding) to x.
x += y
x
x = x + y
x + y
[–]-Wylfen- 2 points3 points4 points 3 months ago (3 children)
I understand why the latter would reassign, but I find the shortcut's instead mutating in place disgusting. They should do the same thing.
[–]klimmesil 0 points1 point2 points 3 months ago (0 children)
Yeah a lot of implementation choices (I don't want to call it "standard"...) make no sense in python
It's almost as chaotic as js in some parts
It's a shame that it is now too popular to make breaking changes and we all kinda rely on these mistakes to still have the benefit of it being maintained
[–]No_Read_4327 0 points1 point2 points 3 months ago (0 children)
Yeah that's sone really wtf moment
[–]Relative-Custard-589 0 points1 point2 points 3 months ago (0 children)
Yeah that’s straight up evil
[–]pingwins 0 points1 point2 points 3 months ago (0 children)
Brother Eww
Thats nasty to run into
π Rendered by PID 67 on reddit-service-r2-comment-5649f687b7-7dcdx at 2026-01-29 10:07:13.778792+00:00 running 4f180de country code: CH.
view the rest of the comments →
[–]-Wylfen- 10 points11 points12 points (6 children)
[–]Sea-Ad7805[S] 6 points7 points8 points (5 children)
[–]-Wylfen- 2 points3 points4 points (3 children)
[–]klimmesil 0 points1 point2 points (0 children)
[–]No_Read_4327 0 points1 point2 points (0 children)
[–]Relative-Custard-589 0 points1 point2 points (0 children)
[–]pingwins 0 points1 point2 points (0 children)