8æ10æ¥ã«ããã¡ã°ãããããPythonã®ææ¬ããåºçããã¾ããã
æ¸ç±ã¯ããã¼ãã©ã¦ãã®ã¡ã³ãã¼ãé´æ¨ããã®ãï¼@takanoryï¼ãæè°·å¼¥æã®ï¼äººã§å·çãã¾ããã
ã¬ãã¥ã¼ã«ã¯ãç§ãå«ãã¦ä»¥ä¸ã®ã¡ã³ãã¼ãåå ãã¦ãã¾ãã
社å ã¬ãã¥ã¢ã¼
ãã«ãã³ã©ãã¹ã
èªè 対象è
以ä¸ã®æ¹ã ã対象ã§ãã
- ããã°ã©ãã³ã°ãå§ããã
- Pythonãå¦ã³ãã
å 容æ§æ
æ¸ç±ã¯10ç« æ§æã§ãã
å 容ã¯ã以ä¸ã®ããã«å¤§ããï¼ã¤ã«åããã¦ãã¾ãã
ã1ãããã°ã©ãã³ã°å ¥é
ããã°ã©ãã³ã°ãå§ããæ¹åãã®å 容ã§ããããã°ã©ãã³ã°ã¨ã¯ä½ããã©ã®ããã«åä½ãã¦ããã®ããPythonã使ã£ã¦ä¸å¯§ã«èª¬æãã¦ãã¾ãã
- 1ç« Pythonãå¦ã¶æºåãããã
- 2ç« ã³ãã³ãããã³ããã«æ £ããã
- 3ç« åºç¤ãå¦ã³ãªããããã°ã©ã ãä½æããã
ã2ãPythonã®åºæ¬ææ³
æãåºæ¬çãã¤é »ç¹ã«ä½¿ç¨ããææ³ã«ã¤ãã¦èª¬æãã¦ãã¾ãã
- 4ç« ç¹°ãè¿ãã¨æ¡ä»¶åå²ãå¦ã¼ã
- 5ç« è¾æ¸ã¨ãã¡ã¤ã«ã®æ±ããå¦ã¼ã
ã3ãã¯ããã¦ã®ã¢ããªã±ã¼ã·ã§ã³éçº
対話åã®botãã¤ãããªãããPythonã®ã©ã¤ãã©ãªã®ä½¿ãæ¹ãå¦ã³ã¾ãã
- 6ç« ä¼è©±botãä½ãã
- 7ç« ã©ã¤ãã©ãªã使ãããªãã
- 8ç« ãµã¼ããã¼ãã£è£½ããã±ã¼ã¸ã使ãããªãã
ã4ãã¯ããã¦ã®Webã¢ããªã±ã¼ã·ã§ã³éçº
8ç« ã¾ã§ã¤ãã£ãbotãWebã¢ããªã±ã¼ã·ã§ã³åãã¾ããWebã¢ããªã±ã¼ã·ã§ã³ã®åºç¤ãå¦ã³ã¾ãã
- 9ç« Webã¢ããªã±ã¼ã·ã§ã³ãä½æããã
ã5ãPythonã®ãããªãå¦ã³æ¹
Pythonãããã«å¦ã¶ããã®ãæ å ±æºã¨ãªãæ¸ç±ããµã¤ããã³ãã¥ããã£ãç´¹ä»ãã¦ãã¾ãã
- 10ç« ããã«ç¥èã身ã«ã¤ããããã®å¦ã³æ¹
ãã®æ¸ç±ã§èªè ãå¾ããããã®
çæéã§ã¹ã¤ã¹ã¤ã¨èªãã¦ç解ã§ãã
ãã®æ¸ç±ã§ã¯ãããã°ã©ãã³ã°ãå§ããã°ããã®æ¹ããããã°ã©ãã³ã°ãã¹ã ã¼ãºã«ç解ããéç¿ã§ãããã¨ãï¼çªã®ç®çã¨ãã¦ãã¾ãã
æ¸ç±ãèªãã¨ãã«ãåãããªãç¨èªããã£ãããå°éç¨èªãå½ããåã«ä½¿ããã¦ããã¨ããã®æç¹ã§èªè ã®ç解ãæ¢ã¾ã£ã¦ãã¾ãã¾ãã
ãã®æ¸ç±ã§ã¯ãèªè ãããã°ã©ãã³ã°ãç解ãã妨ãã«ãªããªããããå 容æ§æããµã³ãã«ãå³ã説æã®ä»æ¹ã«ãããã¾ã§ãæéãããã¦ç²¾æ»ãã¦ãã¾ãã
Pythonicãªæ¸ç±
æ¸ç±ã§ã¯ãããããããæç« ãæ¸ããã¨ã¯å½ããåã®ãã¨ã§ãã
ãªã®ã§ãããã¦ããã§æ¸ããã¨ã§ã¯ãªãããç¥ãã¾ãããããã¼ã å ã§ã¯ä»¥ä¸ã®ãããªãã¨ãæ°ãã¤ãã¦å 容ãç²¾æ»ãã¾ããã
説ææç« ãåé·ã«ãªã£ã¦ããªãããçã説æã§ããªãã
â æç« ãé·ãã¨ãè³å ã¡ã¢ãªã使ã£ã¦ãã¾ããç解ãã«ãããªã
説æãç¨èªãææ§ã«ãªã£ã¦ããªãããæ示çã«èª¬æã§ãã¦ããã
â 説æãç¨èªãææ§ã§æ示çã ã¨ãè³å ã§ä»ã®ç¥èã¨ã®çªãåãã確èªãå ¥ããç解ãæ¢ã¾ã
ç¨èªã«è¡¨è¨ã®ãã¬ããªãã
â 表è¨ã«ãã¬ãããå ´åãè³å ã§ä»ã®ç¥èã¨ã®çªãåãã確èªãå ¥ããç解ãæ¢ã¾ã
æ°ã¥ãã¦ã¿ãã¨ããããæ°ãã¤ãã¦ãããã¨ã¯ãZen of Pythonã*1 ã«æ¸ããã¦ããå 容ãã®ãã®ã§ãã
Explicit is better than implicit.
æ示ããããæ示ããã»ãããã
Readability counts.
èªã¿ããããã¨ã¯åã§ãã
Simple is better than complex.
è¤éã§ããããã¯å¹³æã§ããã»ãããã
There should be one-- and preferably only one --obvious way to do it.
ãã£ãã²ã¨ã¤ã®å´ãããããããããã¯ãã
ãããããã¼ã ã§ç¹°ãè¿ããçµæãç°¡æ½ã§æ示çãªè¡¨ç¾ãè¯ãã¨ããPythonã®ããã«ãèªã人ã«ã¨ã£ã¦ç解ããããPythonic(Pythonããã)ãªæ¸ç±ã«ä»ä¸ããã¾ããã
ã¾ããæ¸ç±ãå ¨ãã¼ã¸ã«ã©ã¼ãªã®ã§ãèªè ã®ç´æçãªç解ã®å©ãã«ãªãã§ãããã
ã¤ã¾ã¥ããããæ¦å¿µãæ«æããã«å¦ã¹ã
å¦ã³ã®æ®µå·®ããªãã¹ãä½ãããããã«å 容ãç·´ããæ§æãã¦ãã¾ãã
åå¿è åãã®æ¸ç±ã¯ãåºæ¬çãªå 容ã並ã¹ãã°æ¸ç±ã«ãªãããã§ã¯ããã¾ããã
å·çæã¯ã以ä¸ã®ä½æ¥ã®ç¹°ãè¿ãã§ãã
- æ¦å¿µãå°éç¨èªããç解ã§ããå°ããªåä½ã«ç´°ããåå²
- ä¼ãããããå¹³æãªè¡¨ç¾ãæ¢ã
- 表ç¾ãã¤ãªãã¦æç« ã«ãã
- ä½åº¦ãèªã¿ãç解ãããããã©ããåè»ãã
ã©ã®ããã«èª¬æãããããã°ã©ãã³ã°ãå§ããã°ããã®æ¹ããã¤ã¾ã¥ããã«ããã°ã©ãã³ã°ã®æ¦å¿µãç解ã§ããã®ãã
ãã®ãã¦ãã¦ã¯ãå¼ç¤¾ã®ç ä¿®ï¼ BePROUD Pythonãã¬ã¼ãã³ã°ããå¼ç¤¾ãµã¼ãã¹ã®Pytnonãªã³ã©ã¤ã³å¦ç¿ãã©ãããã©ã¼ã PyQã§ãPythonããã°ã©ãã³ã°åå¿è åãã®ã³ã³ãã³ããä½æããããæããçµé¨ã®ä¸ã§å¹ããã¦ãã¾ããå·çè ã ãã§ãªããä¸è¨ã®ã¬ãã¥ã¢ã¼ãPythonç ä¿®ã®è¬å¸«ãPyQã®ã³ã³ãã³ãä½æãæ å½ãã¦ãã¾ãã
åãã¦ããã°ã©ãã³ã°ãå¦ã¶æ¹ããæ¥ã å¿ããæéããªãä¸ã§ãããã°ã©ãã³ã°ãå¦ã¼ãã¨æãç«ã£ãæ¹ãã»ã¨ãã ã¨æãã¾ãã
ãã®ãããªå¿ããæéã®ä¸ã§ãå¦ãã æéãã ãã«ãªããªããããæ«æããã«å¦ã¶ãã¨ãã§ããå¼ç¤¾ã®ãã¦ãã¦ããã®æ¸ç±ã«ã¯çãè¾¼ã¾ãã¦ãã¾ãã
èªã¿çµãããã¨ã次ã®ã¹ãããã«ã¹ã ã¼ãºã«é²ã¿ããã
5ç« ã¾ã§ã§åºæ¬ææ³ãå¦ãã ãã¨ã¯ã対話åã®botã«æ©è½ã追å ãã¦ããã«ã¿ãã§ãPythonã®ä½¿ãæ¹ãå¦ãã§ããã¾ã(6ã9ç« )ã
対話åã®botã®ãµã³ãã«ã§ã¯ããã®æ¸ç±ã§å¦ã³çµãã人ããèªåã§ã¢ããªã±ã¼ã·ã§ã³ãã¤ããã¨ãã次ã®ã¹ããããã¤ã¡ã¼ã¸ãããããããå®è·µçãªå 容ãæèãã¦ãã¾ãã
6ã9ç« ãå¦ã¶ãã¨ã§ä»¥ä¸ã®ãã¨ããããã¦ç¥ããã¨ãã§ãã¾ãã
- ã¢ããªã±ã¼ã·ã§ã³ã«æ©è½ãå¾ã ã«è¿½å ãã¦ããæµã
- ã¤ãã£ãã¢ããªã±ã¼ã·ã§ã³ãWebã¢ããªã±ã¼ã·ã§ã³åããæ¹æ³
Pythonã¯ãããåä½ã§ãã¾ãã¾ãªãã¨ãå®ç¾ã§ããã©ã¤ãã©ãªãå¹ åºãæã£ã¦ãããã¨ã§ãããããªã¼å梱(batteries included)ã¨å¼ã°ãã¦ãã¾ãã
Pythonã¨åãããã®æ¸ç±ããããã°ã©ãã³ã°ã®åºæ¬ãPythonã®åºæ¬ææ³ãã¢ããªã±ã¼ã·ã§ã³éçºãWebã®ãµã¼ãã¼ãµã¤ãéçºã¾ã§ãå¹ åºãå梱ããã¦ãã¾ãã®ã§ããã®ä¸åã§å¿ç¨ã§ããåºç¤ã身ã«ã¤ãã¾ãã
ãªã³ã©ã¤ã³Pythonå¦ç¿ãã©ãããã©ã¼ã PyQã¨ã®ã³ã©ãã¬ã¼ã·ã§ã³
æ¸ç±ã«ã¯ãPyQ ç¨ã®ãã£ã³ãã¼ã³ã³ã¼ããè¨è¼ããã¦ãã¾ãã
PyQã¸ã®ä¼å¡ç»é²æã«ãã£ã³ãã¼ã³ã³ã¼ããå ¥åãã¦ããã ãã¨ããã¡ã°ãããããPythonææ¬ãã§å¦ãã å 容ããªã³ã©ã¤ã³ä¸ã§ãããã°ã©ã ãåãããªããå¦ç¿ãããã¨ãã§ãã¾ããï¼åºç¤ææ³ã®ã³ã³ãã³ããå¦ç¿å¯è½ï¼
æå¾ã«
ããã¡ã°ãããããPythonã®ææ¬ããèªã¿ãããå¦ã³ãããå 容ã«ä»ä¸ããããã«ãå稿ãå°å·æã«å ¥ãæ°æéåã¾ã§ãã¼ã ã¡ã³ãã¼ã§ç²ããå 容ãç²¾æ»ãã¾ããã
å·çé£ã»ã¬ãã¥ã¯ã¼ã«ã¨ã£ã¦ãæºè¶³ã®ããæ¸ç±ã«ä»ä¸ããã¾ããã®ã§ããã²æã«ã¨ã£ã¦é ããã°ã¨æãã¾ãã
ããã°ã©ãã³ã°ã¯ãä½ã§æ¶ããã¨ããã¹ãã¼ãã®ãããªå´é¢ãããã¾ãã
ãã®æ¸ç±ã§ã¯ãã·ã³ãã«ãªããå®è·µçãªããã°ã©ã ã®ãµã³ãã«ãç¨æãã¦ãã¾ãã
ãã²ãå®éã«æãåãããªãããããã°ã©ãã³ã°ã楽ããå¦ãã§ãã ããã
- ä½è : é´æ¨ããã®ã,æè°·å¼¥æ,æ ªå¼ä¼ç¤¾ãã¼ãã©ã¦ã
- åºç社/ã¡ã¼ã«ã¼: ã¤ã³ãã¬ã¹
- çºå£²æ¥: 2017/08/10
- ã¡ãã£ã¢: åè¡æ¬ï¼ã½ããã«ãã¼ï¼
- ãã®ååãå«ãããã°ãè¦ã
*1:Zen of Pythonã¨ã¯ãPythonã®ææ³ãã¾ã¨ããæç« ã§ãããimport thisãã¨Pythonã®ããã³ããã«æã¡è¾¼ããã¨ã«ãã表示ããã¾ãã