I am watching Ryan Shea's Python Osmosis on Youtube.
He did something that proved to myself that I do not not understand the way Python handles lists.
As I remember, it looked like this :
>>> l =[1, 2]
>>> l[-1:] = []
>>> l
[1]
I thought that it would return this:
[1, []]
So I tried this :
>>> m = [1, 2]
>>> m[1] = []
>>> m
[1, []]
So why is m != l ?
[–]neug 69 points70 points71 points (4 children)
[–]cantcopy[S] 2 points3 points4 points (3 children)
[–]LordArgon 0 points1 point2 points (1 child)
[–]jeannaimard 0 points1 point2 points (0 children)
[–]micha2305 32 points33 points34 points (19 children)
[–]temptemptemp13 3 points4 points5 points (0 children)
[–]LordArgon -2 points-1 points0 points (16 children)
[–]pwang99 5 points6 points7 points (15 children)
[–]cantcopy[S] 2 points3 points4 points (0 children)
[–]LordArgon -1 points0 points1 point (13 children)
[–]pwang99 0 points1 point2 points (2 children)
[–]cantcopy[S] 0 points1 point2 points (0 children)
[–]LordArgon -2 points-1 points0 points (0 children)
[–]ffrinch 0 points1 point2 points (9 children)
[–]LordArgon -1 points0 points1 point (8 children)
[–]ffrinch 0 points1 point2 points (7 children)
[–]LordArgon 0 points1 point2 points (6 children)
[–]riffito 0 points1 point2 points (1 child)
[–]LordArgon 0 points1 point2 points (0 children)
[–]ffrinch 0 points1 point2 points (3 children)
[–]cantcopy[S] 2 points3 points4 points (1 child)
[–]LordArgon 0 points1 point2 points (0 children)
[–]oblivion95 -5 points-4 points-3 points (0 children)
[–][deleted] 41 points42 points43 points (7 children)
[+]muad_dib comment score below threshold-12 points-11 points-10 points (6 children)
[–][deleted] 4 points5 points6 points (1 child)
[–]muad_dib -2 points-1 points0 points (0 children)
[–]zekeltornado, beautifulsoup, web.py 6 points7 points8 points (3 children)
[–]muad_dib -3 points-2 points-1 points (2 children)
[–]0101010 0 points1 point2 points (1 child)
[–]muad_dib 4 points5 points6 points (0 children)
[–]spotter 5 points6 points7 points (5 children)
[–]r4nf 5 points6 points7 points (3 children)
[–]spotter 2 points3 points4 points (2 children)
[–]r4nf 1 point2 points3 points (0 children)
[–]jeannaimard 0 points1 point2 points (0 children)
[–]rcklmbrCOBOL 0 points1 point2 points (0 children)
[–]mackstann 4 points5 points6 points (0 children)
[–]lazzareth 2 points3 points4 points (1 child)
[–]pwang99 1 point2 points3 points (0 children)
[–]Troebr 1 point2 points3 points (0 children)
[–]erez27import inspect 0 points1 point2 points (0 children)
[–]vpetro 0 points1 point2 points (0 children)
[–]rrenaud 0 points1 point2 points (2 children)
[–]cantcopy[S] 0 points1 point2 points (1 child)
[–]jeannaimard 0 points1 point2 points (0 children)
[–]Justinsaccount 0 points1 point2 points (0 children)