per page, with , order by , clip by
Results of 1 - 10 of about 24 for deque (0.009 sec.)
collections --- コンテナデータ型 16180
collections --- コンテナデータ型 ソースコード: Lib/collections/__init__.py このモジュールは、汎用の Python 組み込みコンテナ dict , list , set , および tuple に代わる、特殊なコンテナデータ型を実装しています。 namedtuple() 名前付きフィールドを ... 持つタプルのサブクラスを作成するファクトリ関数 deque 両端における append や pop を高速に行えるリスト風のコンテナ ChainMap 複数のマッピングの一つのビューを作成する辞書風のクラス ... ith_replacement() を参照してください: map ( Counter , combinations_with_replacement ( 'ABC' , 2 )) # --> AA AB AC BB BC CC deque オブジェクト class collections. deque ( [ iterable [ , maxlen ] ] ) iterable で与えられるデータから、新しい deque オブジェ ... クトを ( append() をつかって) 左から右に初期化して返します。 iterable が指定されない場合、新しい deque オブジェクトは空になります。 Deque とは、スタックとキューを一般化したものです (この名前は「デック」と発音され、これは「dou ...
https://man.mtool.work/python/3.14/library/collections.html
What's New in Python 2.4 8790
What's New in Python 2.4 著者 : A.M. Kuchling この文書は 2005 年 3 月 30 日にリリースされた Python 2.4.1 の新機能について解説します。 Python 2.4 は、真ん中サイズ、のリリースです。急進的だった Python 2.2 ほどには多くの変更をしていませんが、保 ... ンデータ型のための、新しい collections モジュールができました。 現時点では、両端から効率的に要素を追加・削除できる両端キュー deque という一つの型だけが含まれています。 >>> from collections import deque >>> d = deque ( 'ghi' ) # 3 つの要素を持つ新しい de ... que を作る >>> d . append ( 'j' ) # 右側に新しい要素を追加 >>> d . appendleft ( 'f' ) # 左側に新しい要素を追加 >>> d # deque の表現を表示 deque(['f', 'g', 'h', 'i', 'j']) >>> d . pop () # 右端の要素を取り除いて返す 'j' >>> d . popleft () # 左端の要 ... 素を取り除いて返す 'f' >>> list ( d ) # deque の内容をリストにする ['g', 'h', 'i'] >>> 'h' in d # deque を検索 True queue や threading などのモジュールが collections.de ...
https://man.mtool.work/python/3.14/whatsnew/2.4.html
データ型 8640
データ型 この章で解説されるモジュールは日付や時間、型が固定された配列、ヒープキュー、両端キュー、列挙型のような種々の特殊なデータ型を提供します。 Python also provides some built-in data types, in particular, dict , list , set and frozenset ... 群 コマンドラインでの使用 collections --- コンテナデータ型 ChainMap オブジェクト ChainMap の例とレシピ Counter オブジェクト deque オブジェクト deque のレシピ defaultdict オブジェクト defaultdict の使用例 namedtuple() 名前付きフィールドを持つタプルのファ ...
https://man.mtool.work/python/3.14/library/datatypes.html
11. 標準ライブラリをひとめぐり --- その II 8507
11. 標準ライブラリをひとめぐり --- その II ツアーの第2部では、プロフェッショナルプログラミングを支えるもっと高度なモジュールをカバーします。ここで挙げるモジュールは、小さなスクリプトの開発ではほとんど使いません。 11.1. 出力のフォーマット re ... 'H' , [ 4000 , 10 , 700 , 22222 ]) >>> sum ( a ) 26932 >>> a [ 1 : 3 ] array('H', [10, 700]) collections モジュールでは、 deque オブジェクトを提供しています。リスト型に似ていますが、データの追加と左端からの取り出しが速く、その一方で中間にある値の参照 ... は遅くなります。こうしたオブジェクトはキューや木構造の幅優先探索の実装に向いています: >>> from collections import deque >>> d = deque ([ "task1" , "task2" , "task3" ]) >>> d . append ( "task4" ) >>> print ( "Handling" , d . popleft ()) Handli ... ng task1 unsearched = deque ([ starting_node ]) def breadth_first_search ( unsearched ): node = unsearched . popleft () for m in gen_moves ( node ): i ...
https://man.mtool.work/python/3.14/tutorial/stdlib2.html
What's New in Python 2.6 8373
What's New in Python 2.6 著者 : A.M. Kuchling (amk at amk.ca) この記事では、2008 年 10 月 1 日にリリースされた Python 2.6 の新機能を説明します。 リリース日程は PEP 361 に記載されています。 Python 2.6 の主要なテーマは、言語を大幅に再設計する ... 、 exponent フィールドを持つ名前付きタプルを返します。 (Contributed by Raymond Hettinger.) collections のもう一つの変更は、 deque に省略可能な maxlen パラメーターが加わったことです。 指定すると、deque の要素数は maxlen 以下に制限されます。 満杯の deque ... に要素を追加すると、古い要素が捨てられます。 >>> from collections import deque >>> dq = deque ( maxlen = 3 ) >>> dq deque([], maxlen=3) >>> dq . append ( 1 ); dq . append ( 2 ); dq . append ( 3 ) >>> d ... q deque([1, 2, 3], maxlen=3) >>> dq . append ( 4 ) >>> dq deque([2, 3, 4], maxlen=3) (Contributed by Raymond Hettinger.) Cookie モ ...
https://man.mtool.work/python/3.14/whatsnew/2.6.html
5. データ構造 8306
5. データ構造 この章では、すでに学んだことについてより詳しく説明するとともに、いくつか新しいことを追加します。 5.1. リスト型についてもう少し list 型には、他にもいくつかメソッドがあります。リストオブジェクトのすべてのメソッドを以下に示します ... 素を1つずつずらす必要があるためです。詳しくは 組み込み型の操作の時間計算量 を参照してください。 キューの実装には collections.deque を使います。このクラスは両端で要素を高速に追加・取り出しできるように設計されています。例えば次のように使います: >>> from c ... ollections import deque >>> queue = deque ([ "Eric" , "John" , "Michael" ]) >>> queue . append ( "Terry" ) # Terry が到着 >>> queue . append ( "Gr ... 最初に到着した人が去る 'Eric' >>> queue . popleft () # 2番目に到着した人が去る 'John' >>> queue # 残っている人を到着順に表示 deque(['Michael', 'Terry', 'Graham']) 5.1.3. リストの内包表記 リスト内包表記を使うとリストを簡潔に作れます。シーケンスやイテラブ ...
https://man.mtool.work/python/3.14/tutorial/datastructures.html
itertools --- 効率的なループ用のイテレータ生成関数群 8240
itertools --- 効率的なループ用のイテレータ生成関数群 このモジュールは イテレータ を構築する部品を実装しています。プログラム言語 APL, Haskell, SML からアイデアを得ていますが、 Python に適した形に修正されています。 このモジュールは、高速でメモ ... lse , groupby , islice , permutations , product , repeat , starmap , tee , zip_longest ) from collections import Counter , deque from contextlib import suppress from functools import reduce from heapq import heappush , heappushpop , heappush_max , hea ... n ) def tail ( n , iterable ): "最後の n 個の要素を反復するイテレータを返す。" # tail(3, 'ABCDEFG') → E F G return iter ( deque ( iterable , maxlen = n )) def consume ( iterator , n = None ): """iterator を n 個先に進める。 n が None の場合はすべて消 ... 費する。 """ # イテレータを C の速度で消費する関数を使う。 if n is None : deque ( iterator , maxlen = 0 ) else : next ( islice ( iterator , n , n ), None ) def nth ( iterable , n , default = None ): "n ...
https://man.mtool.work/python/3.14/library/itertools.html
What's New In Python 3.9 8090
What's New In Python 3.9 編集者 : Łukasz Langa この記事では Python 3.8 と比較した Python 3.9 の新機能を解説します。 Python 3.9 は 2020 年 10 月 5 日にリリースされました。 詳しくは 変更履歴 を参照してください。 参考 PEP 596 - Python 3.9 リリ ... e_instancevar_slots 35.6 36.1 27.3 26.6 25.7 25.8 Data structure read access: read_list 24.2 24.5 20.8 20.8 19.0 19.5 read_deque 24.7 25.5 20.2 20.6 19.8 20.2 read_dict 24.3 25.7 22.3 23.0 21.0 22.4 read_strdict 22.6 24.3 19.5 21.2 18.9 21.5 Data stru ... cture write access: write_list 27.1 28.5 22.5 21.6 20.0 20.0 write_deque 28.7 30.1 22.7 21.8 23.5 21.7 write_dict 31.4 33.3 29.3 29.2 24.7 25.4 write_strdict 28.4 29.9 27.5 25.2 23.1 24.5 Stack ( ... or queue) operations: list_append_pop 93.4 112.7 75.4 74.2 50.8 50.6 deque_append_pop 43.5 57.0 49.4 49.2 42.5 44.2 deque_append_popleft 43.7 57.3 49.7 49.7 42.8 46.4 Timing loop: loop_overhead 0.5 ...
https://man.mtool.work/python/3.14/whatsnew/3.9.html
What's New In Python 3.8 8023
What's New In Python 3.8 編集者 : Raymond Hettinger この記事では Python 3.7 と比較した Python 3.8 の新機能を解説します。 Python 3.8 は 2019 年 10 月 14 日にリリースされました。 詳しくは 変更履歴 を参照してください。 概要 -- リリースハイライ ... e_instancevar_slots 28.7 35.6 36.1 27.3 26.6 25.7 Data structure read access: read_list 19.2 24.2 24.5 20.8 20.8 19.0 read_deque 19.9 24.7 25.5 20.2 20.6 19.8 read_dict 19.7 24.3 25.7 22.3 23.0 21.0 read_strdict 17.9 22.6 24.3 19.5 21.2 18.9 Data stru ... cture write access: write_list 21.2 27.1 28.5 22.5 21.6 20.0 write_deque 23.8 28.7 30.1 22.7 21.8 23.5 write_dict 25.9 31.4 33.3 29.3 29.2 24.7 write_strdict 22.9 28.4 29.9 27.5 25.2 23.1 Stack ( ... or queue) operations: list_append_pop 144.2 93.4 112.7 75.4 74.2 50.8 deque_append_pop 30.4 43.5 57.0 49.4 49.2 42.5 deque_append_popleft 30.8 43.7 57.3 49.7 49.7 42.8 Timing loop: loop_overhead 0.3 ...
https://man.mtool.work/python/3.14/whatsnew/3.8.html
What's New In Python 3.2 7956
What's New In Python 3.2 著者 : Raymond Hettinger この記事では Python 3.1 と比較した Python 3.2 の新機能を説明します。 Python 3.2 は 2011 年 2 月 20 日にリリースされました。 主な変更点をいくつか取り上げ、例を示します。 すべての詳細については ... 'e'] >>> d . move_to_end ( 'X' ) >>> list ( d ) ['a', 'b', 'd', 'e', 'X'] (Contributed by Raymond Hettinger.) collections.deque クラスに 2 つのメソッド count() と reverse() が追加されました。これでさらに list との置換可能性が増しました: >>> from coll ... ections import deque >>> d = deque ( 'simsalabim' ) >>> d . count ( 's' ) 2 >>> d . reverse () >>> d deque(['m', 'i', 'b', 'a', 'l', 'a', 's', ...
https://man.mtool.work/python/3.14/whatsnew/3.2.html
PREV 1 2 3 NEXT