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
Abstract The objective of this course is to teach programming concepts to biologists. It is thus aimed at people who are not professional computer scientists, but who need a better control of computers for their own research. This programming course is part of a course in informatics for biology. If you are already a programmer, and if you are just looking for an introduction to Python, you can go
SICPの2.2.2 Hierarchical Structures の Mapping over trees あたりを Python でやってみた scheme ;2.2.2 Hierarchical Structures ;Mapping over trees (define (scale-tree tree factor) (cond ((null? tree) ()) ((not (pair? tree)) (* tree factor)) (else (cons (scale-tree (car tree) factor) (scale-tree (cdr tree) factor))))) (scale-tree (list 1 (list 2 (list 3 4) 5) (list 6 7)) 10) ;(10 (20 (30 40) 50) (60 70)) (define
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く