|
783 | 783 | "data": { |
784 | 784 | "text/plain": [ |
785 | 785 | "[Path('files/test.txt.bz2'),\n", |
786 | | - " Path('images/mnist3.png'),\n", |
787 | 786 | " Path('images/att_00000.png'),\n", |
788 | 787 | " Path('images/att_00005.png'),\n", |
789 | | - " Path('images/att_00007.png'),\n", |
790 | 788 | " Path('images/att_00006.png'),\n", |
| 789 | + " Path('images/att_00007.png'),\n", |
| 790 | + " Path('images/mnist3.png'),\n", |
791 | 791 | " Path('images/puppy.jpg')]" |
792 | 792 | ] |
793 | 793 | }, |
|
937 | 937 | "\n", |
938 | 938 | " def __setitem__(self, idx, o):\n", |
939 | 939 | " \"Set `idx` (can be list of indices, or mask, or int) items to `o` (which is broadcast if not iterable)\"\n", |
940 | | - " if isinstance(idx, int): self.items[idx] = o\n", |
| 940 | + " if isinstance(idx, int) or isinstance(idx, slice): self.items[idx] = o\n", |
941 | 941 | " else:\n", |
942 | 942 | " idx = idx if isinstance(idx,L) else listify(idx)\n", |
943 | 943 | " if not is_iter(o): o = [o]*len(idx)\n", |
|
1036 | 1036 | { |
1037 | 1037 | "data": { |
1038 | 1038 | "text/plain": [ |
1039 | | - "[0, 1, 2, 'j', 4, 'k', 6, 7, 8, 9, 10, 11]" |
| 1039 | + "[1, 2, 3, 'j', 4, 'k', 6, 7, 8, 9, 10, 11]" |
1040 | 1040 | ] |
1041 | 1041 | }, |
1042 | 1042 | "execution_count": null, |
|
1054 | 1054 | "test_eq(t[3,5], [\"j\",\"k\"])\n", |
1055 | 1055 | "test_eq(t, L(t))\n", |
1056 | 1056 | "test_eq(L(L(1,2),[3,4]), ([1,2],[3,4]))\n", |
| 1057 | + "t[0:3] = [1, 2, 3]\n", |
| 1058 | + "test_eq(t[0:3], [1, 2, 3])\n", |
1057 | 1059 | "t" |
1058 | 1060 | ] |
1059 | 1061 | }, |
|
1094 | 1096 | { |
1095 | 1097 | "data": { |
1096 | 1098 | "text/plain": [ |
1097 | | - "[6, 11, 0]" |
| 1099 | + "[6, 11, 1]" |
1098 | 1100 | ] |
1099 | 1101 | }, |
1100 | 1102 | "execution_count": null, |
|
4150 | 4152 | "text/markdown": [ |
4151 | 4153 | "---\n", |
4152 | 4154 | "\n", |
4153 | | - "[source](https://github.com/AnswerDotAI/fastcore/blob/main/fastcore/foundation.py#L636){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
| 4155 | + "[source](https://github.com/AnswerDotAI/fastcore/blob/main/fastcore/foundation.py#L650){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
4154 | 4156 | "\n", |
4155 | 4157 | "### Config.get\n", |
4156 | 4158 | "\n", |
|
4245 | 4247 | "text/markdown": [ |
4246 | 4248 | "---\n", |
4247 | 4249 | "\n", |
4248 | | - "[source](https://github.com/AnswerDotAI/fastcore/blob/main/fastcore/foundation.py#L650){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
| 4250 | + "[source](https://github.com/AnswerDotAI/fastcore/blob/main/fastcore/foundation.py#L664){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", |
4249 | 4251 | "\n", |
4250 | 4252 | "### Config.find\n", |
4251 | 4253 | "\n", |
|
0 commit comments