Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
新人教育とPython / PyCon mini Hiroshima 2015
Search
7pairs
November 22, 2015
Programming
1
160
新人教育とPython / PyCon mini Hiroshima 2015
7pairs
November 22, 2015
Tweet
Share
More Decks by 7pairs
See All by 7pairs
Privacy Sandbox on Android / DroidKaigi 2024
7pairs
1
260
テキストマイニングによるプロ野球の順位予想 / Baseball Play Study 2020 Winter
7pairs
0
480
2020年の振り返りとBaseball Play Studyの振り返り / Jisyupy 29
7pairs
0
310
Because Python is there. / Jisyupy 27
7pairs
0
420
野球好きのための快適なプレゼンテーション環境の構築 / Baseball Play Study 2019 Winter
7pairs
0
1k
ちゃんと実装してちゃんとテストしよう / PyCon mini Hiroshima 2019
7pairs
2
860
Pie Meets Py / PyCon JP 2019
7pairs
3
5.3k
テキストマイニングによる新外国人選手の分析 / Baseball Play Study 2019 Spring
7pairs
0
2.7k
テキストマイニングによる応援歌の分析 / Baseball Play Study 2018 Winter
7pairs
0
2.2k
Other Decks in Programming
See All in Programming
LangGraphでのHuman-in-the-Loopの実装
os1ma
3
1.1k
What you can do with Ruby on WebAssembly
kateinoigakukun
0
170
エラーレスポンス設計から考える、0→1開発におけるGraphQLへの向き合い方
bicstone
5
1.5k
Scala アプリケーションのビルドを改善してデプロイ時間を 1/4 にした話 | How I improved the build of my Scala application and reduced deployment time by 4x
nomadblacky
1
180
あなたのアプリ、ログはでてますか?あるいはログをだしてますか? (Funabashi.dev用 軽量版)
uzulla
2
120
Go1.23で入った errorsパッケージの小さなアプデ
kuro_kurorrr
2
390
o1モデルのプロンプトエンジニアリングって?
ktc_wada
0
230
XStateでReactに秩序を与えたい
gizm000
0
730
REXML改善のその後
naitoh
0
190
Modular Monolith Go Server with GraphQL Federation + gRPC
110y
1
580
Crafting Cross-Platform Adventures: Building a Game Engine with Kotlin Multiplatform
dwursteisen
0
120
Rechartsで楽にゴリゴリにカスタマイズする!
10tera
1
170
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
36
2.1k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
WebSockets: Embracing the real-time Web
robhawkes
59
7.3k
Producing Creativity
orderedlist
PRO
340
39k
Atom: Resistance is Futile
akmur
261
25k
Clear Off the Table
cherdarchuk
91
320k
The Straight Up "How To Draw Better" Workshop
denniskardys
230
130k
Bootstrapping a Software Product
garrettdimon
PRO
304
110k
How to name files
jennybc
75
98k
Docker and Python
trallard
39
3k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
190
16k
Gamification - CAS2011
davidbonilla
79
5k
Transcript
৽ਓڭҭͱPython ୩ ५ 2015-11-22 PyCon mini Hiroshima 2015
ࣗݾհ • ୩ ५ʢͤ ͡ΎΜʣ • Twitterɿ@7pairs • GitHubɿhttps://github.com/7pairs •
גࣜձࣾΞΠϞόΠϧॴଐ • ΞυωοτϫʔΫ୲ͷΤϯδχΞ • C#ɺJavaScript…ͳͲ • લ৬·Ͱ15ؒSIerʹۈ • ࠓͷൃදͦͷࠒͷ͓
ΞδΣϯμ • ͳͥ৽ਓڭҭͰPythonΛ࠾༻ͨ͠ͷ͔ • PythonͰڭҭ͕Ͳ͏มΘ͔ͬͨ • PythonͰߨࢣ͕ͨͪͲ͏มΘ͔ͬͨ • ଐ͞Ε͔ͯΒͷҧ͍͋ͬͨͷ͔ •
·ͱΊ
ͳͥ৽ਓڭҭͰPythonΛ࠾༻ͨ͠ͷ͔
ڭҭͷલఏ • ೖࣾޙͷ৽ਓ͞Μʹର͢Δϓϩάϥϛϯάڭҭ • ରʹϓϩάϥϛϯάະܦݧऀؚ·ΕΔ • ܦݧऀڭҭΛૣΊʹΓ্͛Δ͜ͱ… • ڭҭظؒ1ʙ3ϲ݄ʢʹΑͬͯࠩҧ͋Γʣ •
ฒߦͯ͠΄͔ͷݚम࣮ࢪ͢Δ • ϚφʔݚमɺใॲཧجૅɺσʔλϕʔεͳͲ
ڭҭͷత • ઌഐͷࢦಋԼͰۀ͕͜ͳͤΔΑ͏ʹͳΔ͜ͱ • ϓϩάϥϛϯάʹඞཁͳߟ͑ํΛʹ͚ͭΔ͜ͱ • ݴޠͦͷͷͷशख़ʹͩ͜ΘΒͳ͍ • ۀͰؔΘΔػձͷଟ͍Web։ൃʹͭͳ͍͛ͨ •
ݴޠΛΘͣඞཁͱͳΔ͕ࣝଟ͍ • WebΞϓϦͷΈɺηΩϡϦςΟͳͲ
࠾༻͢Δݴޠͷ݅ ʮWindowsڥͰ։ൃͰ͖ͯ…ʯ ʢPythonͩ…ʣ ʮͳهड़Λ͢Δඞཁ͕ͳͯ͘…ʯ ʢPythonͩ…ʣ ʮ͍͠ύϥμΠϜͷݴޠͰͳͯ͘…ʯ ʢPythonͩ…ʣ ʮWebͱͷੑ͕ߴ͍ݴޠͰ…ʯ ʢPythonͩ…ʂʣ
ͦΕ·Ͱͷ৽ਓڭҭ • ࣮Λҙࣝͯ͠JavaͰ࣮ࢪ͢Δ͜ͱ͕ଟ͔ͬͨ • JavaͰଟ͘ͷ͜ͱΛಉ࣌ʹֶͿඞཁ͕͋Δ • ϓϩάϥϛϯάͷߟ͑ํ • ΦϒδΣΫτࢦ •
Javaݴޠͷจ๏
Java൛Hello World // ͓·͡ͳ͍ͱͯ͠ਐΊ͟ΔΛಘͳ͍߲͕ଟ͍ public class HelloWorld { public static
void main(String[] args) { System.out.println("hello, world"); } }
Java൛Hello Worldͷ͓·͡ͳ͍ (1) // Ϋϥε public class HelloWorld { public
static void main(String[] args) { System.out.println("hello, world"); } }
Java൛Hello Worldͷ͓·͡ͳ͍ (2) // ϝιου public class HelloWorld { public
static void main(String[] args) { System.out.println("hello, world"); } }
Java൛Hello Worldͷ͓·͡ͳ͍ (3) // ΞΫηεम০ࢠ public class HelloWorld { public
static void main(String[] args) { System.out.println("hello, world"); } }
Java൛Hello Worldͷ͓·͡ͳ͍ (4) // ੩తʢϝιουʣ public class HelloWorld { public
static void main(String[] args) { System.out.println("hello, world"); } }
Java൛Hello Worldͷ͓·͡ͳ͍ (5) // Γ public class HelloWorld { public
static void main(String[] args) { System.out.println("hello, world"); } }
Java൛Hello Worldͷ͓·͡ͳ͍ (6) // Ҿ public class HelloWorld { public
static void main(String[] args) { System.out.println("hello, world"); } }
Java൛Hello Worldͷ͓·͡ͳ͍ (7) // ྻʢ͘͠ՄมҾʣ public class HelloWorld { public
static void main(String[] args) { System.out.println("hello, world"); } }
Java൛Hello Worldͷ͓·͡ͳ͍ (8) // ύοέʔδ public class HelloWorld { public
static void main(String[] args) { System.out.println("ΤϦνΧɺ͓͏ͪʹؼΔʂ"); } }
͓·͡ͳ͍ͷޮೳ • ͓·͡ͳ͍ͱׂͯ͠ΓΕΔͷ࠽ೳ • ख͕ࢭ·ͬͯ͠·͏ਓ͍Δ • ͓·͡ͳ͍͔ΓͰࣸܦ͔ΒಘΔͷ͕ͳ͘ͳΔ • ͦͷ࣌ͰͷཧղΛ์غ͍ͯ͠Δ
ੜΈग़͞ΕΔࠞಱ • ϑΝΠϧ໊ͱҟͳΔ໊લͷpublicΫϥε • ಉҰϑΝΠϧʹ2ͭͷpublicΫϥε • ಉҰΫϥεʹ2ͭͷmainϝιου • ΤϯτϦϙΠϯτͷͭΓͷmain2ϝιου
Python3൛Hello World // ߨࢣʹ༏͍͠Hello World print("hello, world")
Pythonͷ࠾༻ʹΑͬͯظ͞ΕΔ͜ͱ • Ϋϥε͕ඞͣ͠ඞཁͳ͍ • ͕ؔඞͣ͠ඞཁͳ͍ • ରϞʔυͳΒϑΝΠϧ͢Βඞཁͳ͍ • ࠷ॳͷ͓·͡ͳ͍ͰඍົͳۭؾʹͳΔ͜ͱͳ͍
Α͋͘Δͱճ (1) Q. ࣮ࡍʹۀͰ͏ݴޠͰڭҭ͢Εɺͦͷ͋ͱεϜʔ ζʹ࣮ʹೖΕΔͷͰʁ A. ্࢘ͷࢦࣔͩͱใࠂॻʹॻ͍ͯྑ͍ͷͰ͋Εɺۀ ͰͬͱΘΕ͍ͯΔJava1.4Ͱڭҭ͠·͢ɻ
Α͋͘Δͱճ (2) Q. Pythonͱ͍͏ݴޠฉ͍ͨ͜ͱ͕ͳ͍͕ɺͦΜͳϚΠ φʔͳݴޠͰֶशʹࢧোͳ͍ͷ͔ʁ A. ฐࣾಠࣗϑϨʔϜϫʔΫΑΓ͘ΘΕ͍ͯΔݴ ޠͳͷͰɺࣗश༰қͩͱߟ͍͑ͯ·͢ɻ
PythonͰڭҭ͕Ͳ͏มΘ͔ͬͨ
ಈతܕ͚ݴޠͰ͋Δ • ίʔυΛॻ͘ͱ͖ʹࢼߦࡨޡ͍͢͠ • ҰํͰઃܭͷେ͕͞ΘΓͮΒ͍໘… • ίϨΫγϣϯ͕͍͍͢ • "1" +
1 ͕ 2 ʹͳΒͳ͍ఔͷݫີ͞Λ࣋ͭ
ରϞʔυΛ͍࣋ͬͯΔ • ༷ʑͳ໘Ͱେ׆༂ • ྫΛઆ໌͢Δͱ͖ • ৽ਓ͞Μ͕ࢼߦࡨޡ͢Δͱ͖ • ߨࢣ͕ͬͦ͜Γݴޠ༷Λ֬ೝ͢Δͱ͖ •
PythonΛ࠾༻ͨ͜͠ͱͰڭҭͷਐΊํ͕มΘͬͨ
Webͱͷੑ͕ߴ͍ • Python͚ͩͰWebΞϓϦΛ࡞Δ͜ͱ͕Ͱ͖Δ • JavaͰڭҭ͍ͯͨ͠ࠒͷ͜ͱࢥ͍ग़ͨ͘͠ͳ͍… • TomcatΛೖΕͯ… • Մಡੑͷ͍JSPΛॻ͍ͯ… •
มߋͷͨͼʹ࠶ىಈΛͯ͠…
ςΩετΤσΟλͰॆʹίʔσΟϯάͰ͖Δ • ඇྗͳϚγϯͰͳΜͱ͔ਐΊΔ͜ͱ͕Ͱ͖Δ • JavaͰڭ͍͑ͯͨࠒͷ͜ͱࢥ͍ग़ͨ͘͠ͳ͍… • Eclipseͷىಈʹ5͔͔Δ… • ίʔσΟϯάதʹExcelΛ։͘ͱݻ·Δ…
PythonͰߨࢣ͕ͨͪͲ͏มΘ͔ͬͨ
ֶशͷҙཉ͕ੜ·Εͨ • ਓʹڭ͑ΔͨΊʹ·ͣཧղ͠ͳ͚ΕͳΒͳ͍ • ৽ਓ͞Μʹ࣭͞ΕͨΒ͑ͳ͚ΕͳΒͳ͍ • ͪΖΜӕΛڭ͑ΔΘ͚ʹ͍͔ͳ͍ • ৽͍͜͠ͱΛֶͿָ͠͞Λࢥ͍ग़ͨ͠
ӳޠʹର͢Δ߅ײ͕Β͍ͩ • ެࣜυΩϡϝϯτΛΕΔͱຊޠใ͕গͳ͍ • ֎෦ϥΠϒϥϦͷυΩϡϝϯτ • Stack OverflowͳͲ • ӳޠΛಡ·͟ΔΛಘͳ͍ঢ়گʹ
• ͍ࠐ·ΕΕҙ֎ͱͳΜͱ͔ͳΔ
ۀʹPythonΛऔΓೖΕΔಈ͖ • πʔϧྨΛPythonʹஔ͖͑Δ • Perl͔Βͷஔ͖͑ • γΣϧεΫϦϓτ͔Βͷஔ͖͑ • VBA͔Βͷஔ͖͑ •
ϓϩμΫτͰͷಋೖϋʔυϧ͕ߴ͔ͬͨ…
ଐ͞Ε͔ͯΒͷҧ͍͋ͬͨͷ͔
ΠϯσϯτҒେͩͬͨ • ϒϩοΫ୯ҐͰ͖ͪΜͱΠϯσϯτ͢Δश׳ • نΛҙࣝͨ͠ίʔσΟϯά • PEP8Ғେͩͬͨ
طଘͷػೳΛ͓͏ͱͯ͘͠ΕΔ • ৽ਓ͞Μʹ͋Γ͕ͪͳंྠͷ࠶ൃ໌͕ൃੜͮ͠Β͍ • ඪ४ϥΠϒϥϦͰղܾ͢Δ͜ͱ͕Ͱ͖ͳ͍͔ • APIͷJavadocɺMSDNΛௐΔश׳ • ֎෦ͷϥΠϒϥϦͰղܾ͢Δ͜ͱ͕Ͱ͖ͳ͍͔ •
ͨͩɺͳΜͰ͔ΜͰjarΛՃ͢Δͷ…
ؔΛΦϒδΣΫτͱͯ͠ѻ͏ • mapɺfilterͳͲͰؔΛҾʹࢦఆͨ͠ܦݧ • ΄͔ͷݴޠͰྨਪͯ͠ཧղ͢Δ͜ͱ͕Ͱ͖Δ • C#ɺJavaScriptͳͲ • Java8ʁɹԿͦΕඒຯ͍͠ͷʁ
ੲͳ͕Βͷforจʹށͬͯ͠·͏ for (String str : strArray) { // Pythonͷfor͔ΒͷྨਪͰཧղͰ͖Δ }
for (int i = 0; i < strArray.length; i++) { // Կ͜Εʁɹݟͨ͜ͱ͕ͳ͍ʂ }
ੲͳ͕ΒͷforจΛཧղ͠ͳ͚Ε͍͚ͳ͍ͨͬͨҰͭͷཧ༝ • Java1.4͕ݱͰ͋ΔͨΊ • Python࠾༻2JavaScriptΛྫʹઆ໌
·ͱΊ
·ͱΊ • Pythonͷ࠾༻ʹΑΓɺΞϧΰϦζϜͳͲͷຊʹڭ͑ ͍ͨ෦ʹϑΥʔΧεͰ͖ͨ • ۀͰར༻͠ͳ͍PythonͰڭҭ͢Δ߹ɺͦͷϚΠφ εΛ্ճΔϝϦοτΛఏࣔͰ͖ΔΑ͏ʹ • ৽ਓڭҭߨࢣͷڭҭͰ͋Δ •
Pythonͱ΄͔ͷݴޠͱͷҧ͍Λೝࣝͤ͞ɺ͠Γͳ ͍ػೳ͕͋Δ߹ผݴޠΛྫʹ͢Δ͜ͱඞཁ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠