| 1 |
---input--- |
| 2 |
>>> from multiprocessing import Pool |
| 3 |
>>> p = Pool(5) |
| 4 |
>>> def f(x): |
| 5 |
... return x*x |
| 6 |
... |
| 7 |
>>> with p: |
| 8 |
... p.map(f, [1,2,3]) |
| 9 |
Process PoolWorker-1: |
| 10 |
Process PoolWorker-2: |
| 11 |
Process PoolWorker-3: |
| 12 |
Traceback (most recent call last): |
| 13 |
Traceback (most recent call last): |
| 14 |
Traceback (most recent call last): |
| 15 |
AttributeError: Can't get attribute 'f' on <module '__main__' (<class '_frozen_importlib.BuiltinImporter'>)> |
| 16 |
AttributeError: Can't get attribute 'f' on <module '__main__' (<class '_frozen_importlib.BuiltinImporter'>)> |
| 17 |
AttributeError: Can't get attribute 'f' on <module '__main__' (<class '_frozen_importlib.BuiltinImporter'>)> |
| 18 |
|
| 19 |
---tokens--- |
| 20 |
'>>> ' Generic.Prompt |
| 21 |
'from' Keyword.Namespace |
| 22 |
' ' Text.Whitespace |
| 23 |
'multiprocessing' Name.Namespace |
| 24 |
' ' Text.Whitespace |
| 25 |
'import' Keyword.Namespace |
| 26 |
' ' Text |
| 27 |
'Pool' Name |
| 28 |
'\n' Text.Whitespace |
| 29 |
|
| 30 |
'>>> ' Generic.Prompt |
| 31 |
'p' Name |
| 32 |
' ' Text |
| 33 |
'=' Operator |
| 34 |
' ' Text |
| 35 |
'Pool' Name |
| 36 |
'(' Punctuation |
| 37 |
'5' Literal.Number.Integer |
| 38 |
')' Punctuation |
| 39 |
'\n' Text.Whitespace |
| 40 |
|
| 41 |
'>>> ' Generic.Prompt |
| 42 |
'def' Keyword |
| 43 |
' ' Text.Whitespace |
| 44 |
'f' Name.Function |
| 45 |
'(' Punctuation |
| 46 |
'x' Name |
| 47 |
')' Punctuation |
| 48 |
':' Punctuation |
| 49 |
'\n' Text.Whitespace |
| 50 |
|
| 51 |
'... ' Generic.Prompt |
| 52 |
' ' Text |
| 53 |
'return' Keyword |
| 54 |
' ' Text |
| 55 |
'x' Name |
| 56 |
'*' Operator |
| 57 |
'x' Name |
| 58 |
'\n' Text.Whitespace |
| 59 |
|
| 60 |
'...' Generic.Prompt |
| 61 |
'\n' Text.Whitespace |
| 62 |
|
| 63 |
'>>> ' Generic.Prompt |
| 64 |
'with' Keyword |
| 65 |
' ' Text |
| 66 |
'p' Name |
| 67 |
':' Punctuation |
| 68 |
'\n' Text.Whitespace |
| 69 |
|
| 70 |
'... ' Generic.Prompt |
| 71 |
' ' Text |
| 72 |
'p' Name |
| 73 |
'.' Operator |
| 74 |
'map' Name |
| 75 |
'(' Punctuation |
| 76 |
'f' Name |
| 77 |
',' Punctuation |
| 78 |
' ' Text |
| 79 |
'[' Punctuation |
| 80 |
'1' Literal.Number.Integer |
| 81 |
',' Punctuation |
| 82 |
'2' Literal.Number.Integer |
| 83 |
',' Punctuation |
| 84 |
'3' Literal.Number.Integer |
| 85 |
']' Punctuation |
| 86 |
')' Punctuation |
| 87 |
'\n' Text.Whitespace |
| 88 |
|
| 89 |
'Process PoolWorker-1:\n' Generic.Output |
| 90 |
|
| 91 |
'Process PoolWorker-2:\n' Generic.Output |
| 92 |
|
| 93 |
'Process PoolWorker-3:\n' Generic.Output |
| 94 |
|
| 95 |
'Traceback (most recent call last):\n' Generic.Traceback |
| 96 |
|
| 97 |
'Traceback (most recent call last):\n' Generic.Traceback |
| 98 |
|
| 99 |
'Traceback (most recent call last):\n' Generic.Traceback |
| 100 |
|
| 101 |
'AttributeError' Generic.Error |
| 102 |
': ' Text |
| 103 |
"Can't get attribute 'f' on <module '__main__' (<class '_frozen_importlib.BuiltinImporter'>)>" Name |
| 104 |
'\n' Text.Whitespace |
| 105 |
|
| 106 |
"AttributeError: Can't get attribute 'f' on <module '__main__' (<class '_frozen_importlib.BuiltinImporter'>)>\n" Other |
| 107 |
|
| 108 |
"AttributeError: Can't get attribute 'f' on <module '__main__' (<class '_frozen_importlib.BuiltinImporter'>)>\n" Other |