Explore tweets tagged as #ItertoolsModule
@eranagorka
Gorka Eraña
4 years
@mathsppblog That can be solved by using `itertools.chain.from_iterable`, which also gets rid of the tuple unpacking via `*`. Frankly, I like this better than my previous one. Plus, it has the advantage of being run at C speed: https://t.co/1pCGlbDrVM
1
0
3
@fgshun
fgshun
5 years
技術書典のために書いている Python itertools ネタが嘘八百にならないために調べもの中。公式ドキュメントや itertoolsmodule.c を読む。 https://t.co/OFziM46u6k https://t.co/JoReCuZ00c https://t.co/J8fDJQzXeT
0
0
1
@max747
まっくす
15 years
@tabe1hands ですね。今ソースコード落として確認しました。Modules/itertoolsmodule.c に実装がありました #expertpython
0
0
0
@fgshun
fgshun
3 years
groupby の CPython 3.10.5 における C 実装はこちら。 https://t.co/f33qOdZBQ9
0
0
0
@showyou
Geforce RTX 5070Ti
16 years
oh.. itertoolsmodule.cにpermutations_nextとかまんまっぽいのが・・
0
0
0
@showyou
Geforce RTX 5070Ti
16 years
itertoolsmodule.cとか見たら普通にnext_permutationっぽいものがある件
0
0
0
@ujex256_
ujex_256
2 years
結構共感してくれる人多くて嬉しい ちなみにCPythonのリポジトリ漁ってたら無事C言語の実装でした( https://t.co/snxIPupDsH) えぇ...と思っていたらWikiに移植版(?)があって助かった https://t.co/OiFfRceJKv
@ujex256_
ujex_256
2 years
脳死でitertoolsとかのライブラリを使うより原理とかを知っておいたほうが後々役に立つのかもしれない でも便利だからそのまま使ってしまう
0
1
1
@sin_clav
t-sin🤩
8 years
あーたしかに。itertoolsの関数の実体はクラスっていうか、Cで実装されてたのか。 https://t.co/yHDdDlbgHy
0
0
0
@mopemope
Yutaka Matsubara
15 years
@ryoaita Modules/itertoolsmodule.c
0
0
0
@yoichi22
Yoichi Nakayama
6 years
C実装だけどコメントに等価なPythonのコードも書かれてる。おおよそやってることは一緒でした。 https://t.co/e2nV821XF8
0
0
0
@svartalf
svartalf
13 years
#TIL что `itertools.chain` в #python уютно использует сишный интерфейс для итерирования: http://t.co/WYGepZV0
0
0
0
@yoichi22
Yoichi Nakayama
3 years
builtinになったparwiseは一個前の結果を保持しつつiterateしていく素直な実装になってる https://t.co/K5PMScywTj
0
0
0
@fgshun
fgshun
6 years
初心に返って Python ドキュ……コード読み。 enumerate https://t.co/A4xTk1Ivp8 itertools.count ( https://t.co/N4p9R5dGxN)もそうだったけれども。こいつも PY_SSIZE_T_MAX 未満の値の保持には PyObject 構造体を使わない。高速かつ省メモリ。 en->en_index++;
0
0
0
@fgshun
fgshun
6 years
初心に返って Python ドキュ……いや、 CPython コード読み。 itertools 。 C でクラス定義する例として良質なコードたちだと思っている。 repeat のシンプルさとか count の Py_ssize_t の範囲の内と外で処理が切り替わる工夫とかが好き。
0
0
0
@centoslinux
CentOS Linux
6 years
#centos #linux Re: yum install fails - https://t.co/CjpfY84bqW
0
2
0
@centoslinux
CentOS Linux
6 years
#centos #linux Re: yum install fails - https://t.co/CjpfY84bqW
0
0
0
@JuergenStrobel
Jürgen Strobel
2 years
@parman_the Pretty sure itertools.product is implemented in C and will be much faster than your hand written interpreter loops. Somewhere in there:
1
0
0
@fgshun
fgshun
5 years
初心に返って Python コードリーディング。 itertools repeat 。 times 引数を略すれば無限にくり返すイテレータができる。 repeat('spam') , spam, spam, spam ……。 そんな repeat の C 実装がこれ。モノがモノだけに単純 https://t.co/8Wtr8SJHAz
0
0
0
@fgshun
fgshun
6 years
初心に返って Python ドキュメント……じゃなくてコード読み。 itertools chain 。使うだけでなく実装を読んでもおいしいのが itertools 。 C で CPython のイテレーターを読み書き操作するよい実例。しかもそこまで難しくない。もっと簡単なやつだと repeat とか。 https://t.co/QGf3ZHAOuV
0
0
0
@aymericaugustin
Aymeric Augustin
13 years
@das_kube http://t.co/juz0GjORqw C modules are in Modules, Python modules in Lib.
0
0
0