Upgrade to Pro — share decks privately, control downloads, hide ads and more …

LAMPのP

 LAMPのP

2014/5/9 Livesense SICP倶楽部LT大会にて
Hackの紹介

Livesense Inc.

May 29, 2014
Tweet

More Decks by Livesense Inc.

Other Decks in Programming

Transcript

  1. LIVESENSE
    SICPಡॻձ༻ ࣮༻෦໳

    View full-size slide

  2. LAMPͷP
    MA2SAKA

    View full-size slide

  3. PHPͱ͔PERLͱ͔ҙݟ͸͋Γ·͕͢

    View full-size slide

  4. PYTHON2.X͸૭͔Βࣺͯͯ

    View full-size slide

  5. PYTHON3ܥ΁Ҿͬӽ͠͠·͠ΐ͏

    View full-size slide

  6. ͦ͏͍͑͹͜Μͳ࿩୊΋͋Γ·͕ͨ͠
    • http://hg.python.org/peps/rev/76d43e52d978

    View full-size slide

  7. PYTHON3ܥ΁Ҿͬӽ͠͠·͠ΐ͏

    View full-size slide

  8. NEWEST VERSION IS 3.4

    View full-size slide

  9. ؆୯ʹΠϯετʔϧͰ͖ΔΑ

    View full-size slide

  10. PYTHON3͸2.Xܥͱ͸͍ͩͿҧ͏
    • perl5ͱperl6΄Ͳ͸ҧΘͳ͍
    • python2ܥ͔Βͷ࢓༷มߋ
    • จࣈྻ͕όΠτྻͰ͸ͳ͘Unicodeจࣈྻʹͳͬͨʢେࣄʣ
    • ਺஋͕ int ܕʹ౷Ұ͞Εͨʢେࣄʣ
    • ྫ֎ه๏͕ͪΐͬͱมΘͬͨ
    • print จ͕ࣜʢؔ਺ʣʹͳͬͨ
    • input ͕ raw_input తʹͳͬͨʢpython2ܥͰ͸evalͯͨ͠!ʣ

    View full-size slide

  11. ͜͜·Ͱ࿩ͯ͠ͳΜͰ͕͢

    View full-size slide

  12. 2.Xܥͱͷҧ͍ͳΜͯॏཁͰ͸ͳ͘

    View full-size slide

  13. खଓ͖ܕݴޠPYTHONʹ͍ͭͯ

    View full-size slide

  14. CLASSͳΜࣺͯͯͯ΋OK!

    View full-size slide

  15. ஌Δ΂͖͸FORจͱδΣωϨʔλͱσίϨʔ
    λʢ͋ͱ͍͔ͭ͘ͷίϯςφܕʣͷΈͰ͢

    View full-size slide

  16. ೖྗ͞Εͨσʔλʹରͯ͠
    ॲཧͯ͠ॲཧͯ͠ॲཧͯ݁͠ՌΛฦ͢

    View full-size slide

  17. UNIX఩ֶʮϑΟϧλͱͯ͠࡞Εʯ

    View full-size slide

  18. ίϯςφܕ͸
    LIST, DICT, SET, TUPLE

    View full-size slide

  19. FORจͱδΣωϨʔλ
    • for ͸ʮδΣωϨʔλ͔ΒશͯऔΓग़͢ʯߏจ
    • ruby ͷ each తͳ΋ͷ
    • δΣωϨʔλ͸

    php5.6ͷδΣωϨʔλͱ͍͍ͩͨҰॹ

    View full-size slide

  20. δΣωϨʔλͱ FORจ

    View full-size slide

  21. δΣωϨʔλ
    • yield Ͱ஋Λฦ͢ͱɺͦͷ໭Γ஋͸δΣωϨʔλܕ
    ʹͳΔ
    • ͜Μͳײ͡

    View full-size slide

  22. δΣωϨʔλͷ݁߹(PYTHON3)

    View full-size slide

  23. Ϧετ಺แ
    • ͜͏͍͏΋ͷ͕
    !
    !
    • ͜͏ॻ͚Δ
    !

    View full-size slide

  24. ๨Ε͕ͪ
    • ීஈ໨ʹ͢ΔϦετ಺แදه͸ʮϦετ಺แʯͳͷ
    Ͱશల։͞ΕΔɻʢ஗ԆධՁͰ͸ͳ͍ʣ
    • [x for x in range(10)] <- Ϧετ಺แࣜ
    • (x for x in range(10)) <- δΣωϨʔλࣜ

    View full-size slide

  25. σίϨʔλʔ
    • ߴ֊ؔ਺ͷγϯλοΫεγϡΨʔ

    View full-size slide

  26. ͜Μͳߴ֊ؔ਺͕͋ͬͨ࣌
    ؔ਺ͷద༻݁ՌΛ
    ಉ໊͡લͷؔ਺ʹ୅ೖ
    ͱ͔΍ͬͯͨͷ͕ એݴͬΆ͘ॻ͚Δ

    View full-size slide

  27. PYTHON3.4Ͱ͸ඪ४ϥΠϒϥϦ΋
    େ෯૿ڧ
    • ΦϒδΣΫτࢦ޲తʹύεΛѻ͏pathlibʢ / ͕ԋࢉ
    ࢠΦʔόʔϩʔυ͞Εͯύε۠੾Γʹͳ͍ͬͯΔͱ
    ͍͏!ʣ
    • ඇಉظIOΛѻ͏ asyncio
    • ྻڍܕΛѻ͏ enum
    • ฏۉͱ͔෼ࢄͱ͔ͷ౷ܭؔ਺Ϟδϡʔϧ statictics

    View full-size slide

  28. ฒྻॲཧ೤͍
    • multiprocessing Ϟδϡʔϧʢ2.6- , 3.3- ʣ
    • εϨουʹࣅͨײ͡ͰϩʔΧϧɺϦϞʔτͷฒߦ࣮ߦΛ
    αϙʔτ͢ΔϥΠϒϥϦ
    • ʢpythonͷεϨου͸GILͷ͍ͤͰฒྻ࣮ߦ͕Ͱ͖ͳ͍ʣ
    • asyncio ͱ aiohttp Λ࢖ͬͯ؆୯ฒྻεΫϨΠύʔ
    • http://rdepf.hatenablog.jp/entry/2014/03/25/211802

    View full-size slide

  29. DJANGO΋JINJA2΋FLASK΋
    • python3ରԠࡁΈͰ͢Α!

    View full-size slide

  30. ͋͞օ͞Μ
    • python3ΛΠϯετʔϧ͠·͠ΐ͏!

    View full-size slide

  31. ࢀߟจݙ
    • DiveIntoPython3
    • http://diveintopython3-ja.rdy.jp/index.html
    • LISPϓϩάϥϚͷͨΊͷ python ೖ໳
    • http://www.unixuser.org/~euske/doc/python/
    python-lisp-j.html

    View full-size slide

  32. ࿩͸มΘΓ·͕͢…

    View full-size slide

  33. LAMPͷPͱ͍͑͹PASCALΛ͓๨Ε
    Ͱ͸ʁ

    View full-size slide

  34. দࡔ΋͍ͩͿ๨ΕͯͨͷͰGOOGLE

    View full-size slide

  35. ͜Ε͸Ͳ͏͍͏͜ͱ͔!?

    View full-size slide

  36. χʔζ͸͋Δ!

    View full-size slide

  37. ͱࠓேࢥͬͨ

    View full-size slide

  38. • 1passͰϑΝΠϧ୯ҐͷίϯύΠϧ͕Մೳͳ͜ͱʹͩ͜Θͬͨ
    ߏจ
    • ڭҭ༻ͱͯ͠࡞ΒΕͨૉੑͷ៉ྷͳઃܭ
    • ࣮ߦϑΝΠϧͷߴ଎ੑ
    • namespace͕ͳ͍
    • procedureͱ͔typeͱ͔
    • Ϋϥεఆ͕ٛObjCʹͪΐͬͱࣅͯΔ

    View full-size slide

  39. ͜ͷ࣮ߦϑΝΠϧͷେ͖͞Α…

    View full-size slide

  40. দࡔ͸ͦͬͱλʔϛφϧΛดͨ͡
    ʢো֐͔͋ͬͨΒ͞ɾɾɾʢ͍͍Θ͚ʣʣ

    View full-size slide

  41. PYTHON΋PASCAL΋1τʔΫϯઌ
    ಡΈͰύʔα͕ॻ͚ΔͷͰ͓קΊͰ͢ɻ

    View full-size slide