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
170
新人教育と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
540
テキストマイニングによるプロ野球の順位予想 / Baseball Play Study 2020 Winter
7pairs
0
490
2020年の振り返りとBaseball Play Studyの振り返り / Jisyupy 29
7pairs
0
320
Because Python is there. / Jisyupy 27
7pairs
0
440
野球好きのための快適なプレゼンテーション環境の構築 / Baseball Play Study 2019 Winter
7pairs
0
1k
ちゃんと実装してちゃんとテストしよう / PyCon mini Hiroshima 2019
7pairs
2
880
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
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
1
300
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.1k
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
340
cmp.Or に感動した
otakakot
3
200
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
180
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
190
Jakarta EE meets AI
ivargrimstad
0
650
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
600
Figma Dev Modeで変わる!Flutterの開発体験
watanave
0
140
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
4
1.4k
Featured
See All Featured
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
Done Done
chrislema
181
16k
Rails Girls Zürich Keynote
gr2m
94
13k
What's new in Ruby 2.0
geeforr
343
31k
For a Future-Friendly Web
brad_frost
175
9.4k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
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ͱ΄͔ͷݴޠͱͷҧ͍Λೝࣝͤ͞ɺ͠Γͳ ͍ػೳ͕͋Δ߹ผݴޠΛྫʹ͢Δ͜ͱඞཁ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠