mirror of
https://github.com/rasbt/python_reference.git
synced 2025-05-04 10:33:35 +00:00
fixed wrong generator test
This commit is contained in:
parent
b47af2f2e6
commit
1852c979d7
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"name": "",
|
"name": "",
|
||||||
"signature": "sha256:ae2429a793f28d6caf410da8ce5690a243070d84b5eb141245c096e374c168d5"
|
"signature": "sha256:9b684ae1d67b480d34f80c15b281859c0bc91e94b26b941fa04ce142f3505c5d"
|
||||||
},
|
},
|
||||||
"nbformat": 3,
|
"nbformat": 3,
|
||||||
"nbformat_minor": 0,
|
"nbformat_minor": 0,
|
||||||
@ -1108,19 +1108,19 @@
|
|||||||
"input": [
|
"input": [
|
||||||
"def test_plainlist(plain_list):\n",
|
"def test_plainlist(plain_list):\n",
|
||||||
" for i in plain_list:\n",
|
" for i in plain_list:\n",
|
||||||
" print(i)\n",
|
" pass\n",
|
||||||
"\n",
|
"\n",
|
||||||
"def test_listcompr(listcompr):\n",
|
"def test_listcompr(listcompr):\n",
|
||||||
" for i in listcompr:\n",
|
" for i in listcompr:\n",
|
||||||
" print(i)\n",
|
" pass\n",
|
||||||
"\n",
|
"\n",
|
||||||
"def test_generator(generator):\n",
|
"def test_generator(generator):\n",
|
||||||
" for i in generator:\n",
|
" for i in generator:\n",
|
||||||
" print(i)\n",
|
" pass\n",
|
||||||
"\n",
|
"\n",
|
||||||
"def test_generator_yield(generator_yield):\n",
|
"def test_generator_yield(generator_yield):\n",
|
||||||
" for i in generator_yield:\n",
|
" for i in generator_yield:\n",
|
||||||
" print(i)\n",
|
" pass\n",
|
||||||
"\n",
|
"\n",
|
||||||
"print('plain_list: ', end = '')\n",
|
"print('plain_list: ', end = '')\n",
|
||||||
"%timeit test_plainlist\n",
|
"%timeit test_plainlist\n",
|
||||||
@ -1138,7 +1138,7 @@
|
|||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"stream": "stdout",
|
"stream": "stdout",
|
||||||
"text": [
|
"text": [
|
||||||
"plain_list: 10000000 loops, best of 3: 54.5 ns per loop"
|
"plain_list: 10000000 loops, best of 3: 55.6 ns per loop"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1147,7 +1147,7 @@
|
|||||||
"text": [
|
"text": [
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"listcompr: 10000000 loops, best of 3: 54.4 ns per loop"
|
"listcompr: 10000000 loops, best of 3: 54.8 ns per loop"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1165,7 +1165,7 @@
|
|||||||
"text": [
|
"text": [
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"generator_yield: 10000000 loops, best of 3: 52.4 ns per loop"
|
"generator_yield: 10000000 loops, best of 3: 54.7 ns per loop"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1176,7 +1176,7 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"prompt_number": 1
|
"prompt_number": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"name": "",
|
"name": "",
|
||||||
"signature": "sha256:ae2429a793f28d6caf410da8ce5690a243070d84b5eb141245c096e374c168d5"
|
"signature": "sha256:9b684ae1d67b480d34f80c15b281859c0bc91e94b26b941fa04ce142f3505c5d"
|
||||||
},
|
},
|
||||||
"nbformat": 3,
|
"nbformat": 3,
|
||||||
"nbformat_minor": 0,
|
"nbformat_minor": 0,
|
||||||
@ -1108,19 +1108,19 @@
|
|||||||
"input": [
|
"input": [
|
||||||
"def test_plainlist(plain_list):\n",
|
"def test_plainlist(plain_list):\n",
|
||||||
" for i in plain_list:\n",
|
" for i in plain_list:\n",
|
||||||
" print(i)\n",
|
" pass\n",
|
||||||
"\n",
|
"\n",
|
||||||
"def test_listcompr(listcompr):\n",
|
"def test_listcompr(listcompr):\n",
|
||||||
" for i in listcompr:\n",
|
" for i in listcompr:\n",
|
||||||
" print(i)\n",
|
" pass\n",
|
||||||
"\n",
|
"\n",
|
||||||
"def test_generator(generator):\n",
|
"def test_generator(generator):\n",
|
||||||
" for i in generator:\n",
|
" for i in generator:\n",
|
||||||
" print(i)\n",
|
" pass\n",
|
||||||
"\n",
|
"\n",
|
||||||
"def test_generator_yield(generator_yield):\n",
|
"def test_generator_yield(generator_yield):\n",
|
||||||
" for i in generator_yield:\n",
|
" for i in generator_yield:\n",
|
||||||
" print(i)\n",
|
" pass\n",
|
||||||
"\n",
|
"\n",
|
||||||
"print('plain_list: ', end = '')\n",
|
"print('plain_list: ', end = '')\n",
|
||||||
"%timeit test_plainlist\n",
|
"%timeit test_plainlist\n",
|
||||||
@ -1138,7 +1138,7 @@
|
|||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"stream": "stdout",
|
"stream": "stdout",
|
||||||
"text": [
|
"text": [
|
||||||
"plain_list: 10000000 loops, best of 3: 54.5 ns per loop"
|
"plain_list: 10000000 loops, best of 3: 55.6 ns per loop"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1147,7 +1147,7 @@
|
|||||||
"text": [
|
"text": [
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"listcompr: 10000000 loops, best of 3: 54.4 ns per loop"
|
"listcompr: 10000000 loops, best of 3: 54.8 ns per loop"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1165,7 +1165,7 @@
|
|||||||
"text": [
|
"text": [
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"generator_yield: 10000000 loops, best of 3: 52.4 ns per loop"
|
"generator_yield: 10000000 loops, best of 3: 54.7 ns per loop"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1176,7 +1176,7 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"prompt_number": 1
|
"prompt_number": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user