<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://monobook.org/w/index.php?action=history&amp;feed=atom&amp;title=%E3%83%95%E3%82%A3%E3%83%9C%E3%83%8A%E3%83%83%E3%83%81%E6%95%B0%2FPython</id>
	<title>フィボナッチ数/Python - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://monobook.org/w/index.php?action=history&amp;feed=atom&amp;title=%E3%83%95%E3%82%A3%E3%83%9C%E3%83%8A%E3%83%83%E3%83%81%E6%95%B0%2FPython"/>
	<link rel="alternate" type="text/html" href="https://monobook.org/w/index.php?title=%E3%83%95%E3%82%A3%E3%83%9C%E3%83%8A%E3%83%83%E3%83%81%E6%95%B0/Python&amp;action=history"/>
	<updated>2026-07-19T14:27:16Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://monobook.org/w/index.php?title=%E3%83%95%E3%82%A3%E3%83%9C%E3%83%8A%E3%83%83%E3%83%81%E6%95%B0/Python&amp;diff=1902&amp;oldid=prev</id>
		<title>2014年8月6日 (水) 13:05にimported&gt;Administratorによる</title>
		<link rel="alternate" type="text/html" href="https://monobook.org/w/index.php?title=%E3%83%95%E3%82%A3%E3%83%9C%E3%83%8A%E3%83%83%E3%83%81%E6%95%B0/Python&amp;diff=1902&amp;oldid=prev"/>
		<updated>2014-08-06T13:05:42Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2014年8月6日 (水) 13:05時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l2&quot;&gt;2行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;2行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 記述例1 ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 記述例1 ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Python]]ではPython 2.4から導入された[[デコレーター]]を用いて[[メタプログラミング]]を実現した人がおり&amp;lt;ref&amp;gt;http://d.hatena.ne.jp/wasabiz/20110118/1295335821&amp;lt;/ref&amp;gt;、それを使えば[[関数]]の頭に「@&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tail_recursive」と書くことで末尾再帰最適化を明示することができる。&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Python]]ではPython 2.4から導入された[[デコレーター]]を用いて[[メタプログラミング]]を実現した人がおり&amp;lt;ref&amp;gt;http://d.hatena.ne.jp/wasabiz/20110118/1295335821&amp;lt;/ref&amp;gt;、それを使えば[[関数]]の頭に「@&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tail_recursive」と書くことで[[末尾再帰最適化]]を明示することができる。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;なお、同じくものを[[クラス]]ではなく[[クロージャー]]で書き直した人もいる&amp;lt;ref&amp;gt;http://d.hatena.ne.jp/tanihito/20110119/1295459297&amp;lt;/ref&amp;gt;。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;なお、同じくものを[[クラス]]ではなく[[クロージャー]]で書き直した人もいる&amp;lt;ref&amp;gt;http://d.hatena.ne.jp/tanihito/20110119/1295459297&amp;lt;/ref&amp;gt;。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>imported&gt;Administrator</name></author>
	</entry>
	<entry>
		<id>https://monobook.org/w/index.php?title=%E3%83%95%E3%82%A3%E3%83%9C%E3%83%8A%E3%83%83%E3%83%81%E6%95%B0/Python&amp;diff=1901&amp;oldid=prev</id>
		<title>2014年2月27日 (木) 02:42にimported&gt;Fallout New Tokyoによる</title>
		<link rel="alternate" type="text/html" href="https://monobook.org/w/index.php?title=%E3%83%95%E3%82%A3%E3%83%9C%E3%83%8A%E3%83%83%E3%83%81%E6%95%B0/Python&amp;diff=1901&amp;oldid=prev"/>
		<updated>2014-02-27T02:42:43Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2014年2月27日 (木) 02:42時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l5&quot;&gt;5行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;5行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;なお、同じくものを[[クラス]]ではなく[[クロージャー]]で書き直した人もいる&amp;lt;ref&amp;gt;http://d.hatena.ne.jp/tanihito/20110119/1295459297&amp;lt;/ref&amp;gt;。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;なお、同じくものを[[クラス]]ではなく[[クロージャー]]で書き直した人もいる&amp;lt;ref&amp;gt;http://d.hatena.ne.jp/tanihito/20110119/1295459297&amp;lt;/ref&amp;gt;。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;これらを用いた記述例は以下のようになる。[[末尾呼び出し最適化]]を用いない場合には「@tail_recursive 」の記述を消せばよい。その場合は[[&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;エントリーポイント&lt;/del&gt;]]内の[[ループ変数]]「x」が大きいと[[スタックオーバーフロー]]を起こすと思う。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;これらを用いた記述例は以下のようになる。[[末尾呼び出し最適化]]を用いない場合には「@tail_recursive 」の記述を消せばよい。その場合は[[&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;エントリポイント&lt;/ins&gt;]]内の[[ループ変数]]「x」が大きいと[[スタックオーバーフロー]]を起こすと思う。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>imported&gt;Fallout New Tokyo</name></author>
	</entry>
	<entry>
		<id>https://monobook.org/w/index.php?title=%E3%83%95%E3%82%A3%E3%83%9C%E3%83%8A%E3%83%83%E3%83%81%E6%95%B0/Python&amp;diff=1900&amp;oldid=prev</id>
		<title>58.98.183.133: ページの作成：「Pythonのフィボナッチ数（fibonacci）の記述例。  == 記述例1 == PythonではPython 2.4から導入されたデコレーターを用いて...」</title>
		<link rel="alternate" type="text/html" href="https://monobook.org/w/index.php?title=%E3%83%95%E3%82%A3%E3%83%9C%E3%83%8A%E3%83%83%E3%83%81%E6%95%B0/Python&amp;diff=1900&amp;oldid=prev"/>
		<updated>2012-05-02T05:51:53Z</updated>

		<summary type="html">&lt;p&gt;ページの作成：「&lt;a href=&quot;/wiki/Python&quot; title=&quot;Python&quot;&gt;Python&lt;/a&gt;の&lt;a href=&quot;/wiki/%E3%83%95%E3%82%A3%E3%83%9C%E3%83%8A%E3%83%83%E3%83%81%E6%95%B0&quot; title=&quot;フィボナッチ数&quot;&gt;フィボナッチ数&lt;/a&gt;（fibonacci）の記述例。  == 記述例1 == &lt;a href=&quot;/wiki/Python&quot; title=&quot;Python&quot;&gt;Python&lt;/a&gt;ではPython 2.4から導入された&lt;a href=&quot;/w/index.php?title=%E3%83%87%E3%82%B3%E3%83%AC%E3%83%BC%E3%82%BF%E3%83%BC&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;「デコレーター」 (存在しないページ)&quot;&gt;デコレーター&lt;/a&gt;を用いて...」&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Python]]の[[フィボナッチ数]]（fibonacci）の記述例。&lt;br /&gt;
&lt;br /&gt;
== 記述例1 ==&lt;br /&gt;
[[Python]]ではPython 2.4から導入された[[デコレーター]]を用いて[[メタプログラミング]]を実現した人がおり&amp;lt;ref&amp;gt;http://d.hatena.ne.jp/wasabiz/20110118/1295335821&amp;lt;/ref&amp;gt;、それを使えば[[関数]]の頭に「@tail_recursive」と書くことで末尾再帰最適化を明示することができる。&lt;br /&gt;
なお、同じくものを[[クラス]]ではなく[[クロージャー]]で書き直した人もいる&amp;lt;ref&amp;gt;http://d.hatena.ne.jp/tanihito/20110119/1295459297&amp;lt;/ref&amp;gt;。&lt;br /&gt;
&lt;br /&gt;
これらを用いた記述例は以下のようになる。[[末尾呼び出し最適化]]を用いない場合には「@tail_recursive 」の記述を消せばよい。その場合は[[エントリーポイント]]内の[[ループ変数]]「x」が大きいと[[スタックオーバーフロー]]を起こすと思う。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
def fib(n):&lt;br /&gt;
    @tail_recursive&lt;br /&gt;
    def fib_iter(a, b, m):&lt;br /&gt;
        return a if m == 0 else fib_iter(b, a + b, m - 1)&lt;br /&gt;
    return fib_iter(0, 1, n)&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
    for x in range(1, 100):&lt;br /&gt;
        print fib(x),&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 関連項目 ==&lt;br /&gt;
* [[Python]]&lt;br /&gt;
&lt;br /&gt;
== 参考文献 ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 外部リンク ==&lt;br /&gt;
&lt;br /&gt;
{{stub}}&lt;/div&gt;</summary>
		<author><name>58.98.183.133</name></author>
	</entry>
</feed>