mirror of
https://github.com/rasbt/python_reference.git
synced 2024-11-27 22:11:13 +00:00
fixed wrong generator test
This commit is contained in:
parent
b47af2f2e6
commit
1852c979d7
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"metadata": {
|
||||
"name": "",
|
||||
"signature": "sha256:ae2429a793f28d6caf410da8ce5690a243070d84b5eb141245c096e374c168d5"
|
||||
"signature": "sha256:9b684ae1d67b480d34f80c15b281859c0bc91e94b26b941fa04ce142f3505c5d"
|
||||
},
|
||||
"nbformat": 3,
|
||||
"nbformat_minor": 0,
|
||||
|
@ -1108,19 +1108,19 @@
|
|||
"input": [
|
||||
"def test_plainlist(plain_list):\n",
|
||||
" for i in plain_list:\n",
|
||||
" print(i)\n",
|
||||
" pass\n",
|
||||
"\n",
|
||||
"def test_listcompr(listcompr):\n",
|
||||
" for i in listcompr:\n",
|
||||
" print(i)\n",
|
||||
" pass\n",
|
||||
"\n",
|
||||
"def test_generator(generator):\n",
|
||||
" for i in generator:\n",
|
||||
" print(i)\n",
|
||||
" pass\n",
|
||||
"\n",
|
||||
"def test_generator_yield(generator_yield):\n",
|
||||
" for i in generator_yield:\n",
|
||||
" print(i)\n",
|
||||
" pass\n",
|
||||
"\n",
|
||||
"print('plain_list: ', end = '')\n",
|
||||
"%timeit test_plainlist\n",
|
||||
|
@ -1138,7 +1138,7 @@
|
|||
"output_type": "stream",
|
||||
"stream": "stdout",
|
||||
"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": [
|
||||
"\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": [
|
||||
"\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",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"metadata": {
|
||||
"name": "",
|
||||
"signature": "sha256:ae2429a793f28d6caf410da8ce5690a243070d84b5eb141245c096e374c168d5"
|
||||
"signature": "sha256:9b684ae1d67b480d34f80c15b281859c0bc91e94b26b941fa04ce142f3505c5d"
|
||||
},
|
||||
"nbformat": 3,
|
||||
"nbformat_minor": 0,
|
||||
|
@ -1108,19 +1108,19 @@
|
|||
"input": [
|
||||
"def test_plainlist(plain_list):\n",
|
||||
" for i in plain_list:\n",
|
||||
" print(i)\n",
|
||||
" pass\n",
|
||||
"\n",
|
||||
"def test_listcompr(listcompr):\n",
|
||||
" for i in listcompr:\n",
|
||||
" print(i)\n",
|
||||
" pass\n",
|
||||
"\n",
|
||||
"def test_generator(generator):\n",
|
||||
" for i in generator:\n",
|
||||
" print(i)\n",
|
||||
" pass\n",
|
||||
"\n",
|
||||
"def test_generator_yield(generator_yield):\n",
|
||||
" for i in generator_yield:\n",
|
||||
" print(i)\n",
|
||||
" pass\n",
|
||||
"\n",
|
||||
"print('plain_list: ', end = '')\n",
|
||||
"%timeit test_plainlist\n",
|
||||
|
@ -1138,7 +1138,7 @@
|
|||
"output_type": "stream",
|
||||
"stream": "stdout",
|
||||
"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": [
|
||||
"\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": [
|
||||
"\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",
|
||||
|
|
Loading…
Reference in New Issue
Block a user