Decorator-based implementation of PEP 380 (yield from). This is the optimized version (special handling of nested "yield _from"s). 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 import sys, os, struct, traceback from cStringIO imp
ActiveState Code (http://code.activestate.com/recipes/576429/) Dan Spitz submitted a recipe ( 576410 ) for recursively defined lazy lists backed by a generator. Only catch was that it was written for python 3k. But there is nothing intrinsic in 3k that prevents you from having the same functionality in python 2.5, so I am supplying the backport here. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
safer serialization of simple python types (Python recipe) by S W Unpickling from an untrusted source, such as a network connection, can allow maliciously formed pickles to run arbitrary code. This recipe presents a simple solution for serializing and unserializing simple Python types. Only simple Python types can be serialized, which makes the use of this algorithm safer than using the pickle mod
safer serialization of simple python types, part two (Python recipe) by S W This recipe is a reimplemtation of this recipe, http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/415503 using Python 2.4 decorator syntax. It also has added support for boolean and unicode types, and a keyword argument (compress=False) for the dumps function, which will compress the string. 1 2 3 4 5 6 7 8 9 10 11 1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 ''' Implementation of the fixed point combinator Y. ----------------------------------------------- The Y combinator is a higher order function that suffices following relation: Y(F) = F(Y(F)) From the fixed point property we can get an idea on
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く