on t the usa usage o of p pyth thonic i c idioms ms
play

On t the Usa Usage o of P Pyth thonic I c Idioms ms Carol V. - PowerPoint PPT Presentation

Onward! 2018 Boston Park Plaza Hotel Boston, Massachusetts, United States 07 November 2018 On t the Usa Usage o of P Pyth thonic I c Idioms ms Carol V. Alexandru , Jos J. Merchante, Sebastiano Panichella , Sebastian Proksch,


  1. Onward! 2018 Boston Park Plaza Hotel Boston, Massachusetts, United States 07 November 2018 On t the Usa Usage o of P Pyth thonic I c Idioms ms Carol V. Alexandru ¹, José J. Merchante², Sebastiano Panichella¹ , ³ Sebastian Proksch¹, Harald C. Gall¹, Gregorio Robles² ¹Software Evolution and Architecture Lab, University of Zurich, Switzerland {alexandru,proksch,gall}@ifi.uzh.ch ²Grupo de Sistemas y Comunicaciones, Universidad Rey Juan Carlos, Spain jj.merchante@alumnos.urjc.es, grex@gsyc.urjc.es ³Service Prototype Lab, Zurich University of Applied Sciences, Switzerland panc@zhaw.ch

  2. Carol V. Sebastiano Sebastian Harald C. Alexandru Panichella Proksch Gall José J. Gregorio Merchante Robles

  3. Th Things t to k know a about t Pyth thon 4

  4. Th Things t to k know a about t Pyth thon ● Cr Crea eated ted by y Guido van Rossum 5

  5. Th Things t to k know a about t Pyth thon ● Cr Crea eated ted by y Guido van Rossum – He is (was) the “Benevolent Dictator for Life” – Makes the final decisions when necessary 6

  6. Th Things t to k know a about t Pyth thon ● Cr Crea eated ted by y Guido van Rossum – He is (was) the “Benevolent Dictator for Life” – Makes the final decisions when necessary ● Str trong principles es – The “Zen of Python” >>> import this 7

  7. Th Things t to k know a about t Pyth thon 8

  8. Th Things t to k know a about t Pyth thon ● Cr Crea eated ted by y Guido van Rossum – He is (was) the “Benevolent Dictator for Life” – Makes the final decisions when necessary ● Str trong principles es – The “Zen of Python” >>> import this – Python Enhancement Proposals (PEPs) 9

  9. Th Things t to k know a about t Pyth thon ● Cr Crea eated ted by y Guido van Rossum – He is (was) the “Benevolent Dictator for Life” – Makes the final decisions when necessary ● Str trong principles es – The “Zen of Python” >>> import this – Python Enhancement Proposals (PEPs) ● Wi Widesprea ead adopti tion across many y fi fiel elds 10

  10. Py Pythonic a c appears to s to b be 'a th thing' 11 11

  11. Py Pythonic a c appears to s to b be 'a th thing' “It would be more pythonic to...” 12

  12. A simp mple q question 13

  13. T op Answer cl r claims t ms to b be e “pythonic” c”... ... 14

  14. .. ...but t 100s 0s of people se seem em sce ceptica cal 15

  15. “Pythonic” c” beca cause of t the s style guide ( (PEP 8) PEP 8) 16

  16. “Pythonic” c” beca cause o of p performa rmance ce 17

  17. Idioms ms and signaling 18

  18. Idioms ms and signaling 19

  19. And th there a are exceptions 20

  20. Cr Creati tive use o of th the word “Pyth thonic” c” 21

  21. Is th s there a a d definiti tion f for “Pyth thonic” c”? 22

  22. Is th s there a a d definiti tion f for “Pyth thonic” c”? 23

  23. Is th s there a a d definiti tion f for “Pyth thonic” c”? 24

  24. Is th s there a a d definiti tion f for “Pyth thonic” c”? 25

  25. Pyth thonic c vs. N s. Non-pyth thonic 26

  26. Pyth thonic c vs. N s. Non-pyth thonic 27

  27. Pyth thonic c vs. N s. Non-pyth thonic 28

  28. Is th s there a a d definiti tion f for “Pyth thonic” c”? So it' t's “Using Pyth ython-specific syn yntax x and concep epts ts”, right? But t what t do devel eveloper ers bel elieve? eve? 29

  29. Let' t's ask k a f few d devel elopers Interviews done ● in Person ● at a Python conference ● in Spain ● using open questions 30

  30. Let' t's ask k a f few d devel elopers Interviews done ● in Person ● at a Python conference ● in Spain ● using open questions 31

  31. What t does P s Pythonic c me mean? 32

  32. What t does P s Pythonic c me mean? “ elegant and readable code” “makes code easier to understand and maintain ” “boosts readability and performance ” 33

  33. What t does P s Pythonic c me mean? “ elegant and readable code” “makes code easier to understand and maintain ” “boosts readability and performance ” “using features provided by the language or standard library” 34

  34. What t does P s Pythonic c me mean? “ elegant and readable code” “makes code easier to understand and maintain ” “boosts readability and performance ” “using features provided “simply the most by the language or accepted way of writing standard library” python” 35

  35. Usi Using Py Python i idioms ms != != Pyth thonic 36

  36. Usi Using Py Python i idioms ms != != Pyth thonic → Using idioms → ms != = Pyth ythonic code → → Using idioms ms != = always mo more e readable 37

  37. Novice ce vs. P s. Pro Novi ovice: Pro: o: – Better style – Using built-in functionality – Fewer lines of code – Efficient execution 38

  38. Novice ce vs. P s. Pro Novi ovice: Pro: o: – Better style – Using built-in functionality – Fewer lines of code – Efficient execution – Using idioms – Writing elegant code 39

  39. Novice ce vs. P s. Pro Novi ovice: Pro: o: – Better style – Using built-in functionality – Fewer lines of code – Efficient execution – Using idioms – Writing elegant code – Simpler interpretation – Less concrete interpretation 40

  40. Le Learn rning ' 'Pyth thonic' c'? 41

  41. Le Learn rning ' 'Pyth thonic' c'? “StackOverflow shows you multiple points of view of people, and you always learn.” 42

  42. Le Learn rning ' 'Pyth thonic' c'? “StackOverflow shows you multiple points of view of people, and you always learn.” “ reading code in repositories of other projects” “saw them in documentation ” 43

  43. Le Learn rning ' 'Pyth thonic' c'? “StackOverflow shows you multiple points of view of people, and you always learn.” “ reading code in repositories of other projects” “saw them in documentation ” “from colleagues during code review” 44

  44. Le Learn rning ' 'Pyth thonic' c'? “StackOverflow shows you multiple points of view of people, and you always learn.” “ reading code in repositories of other projects” “My code became more “saw them in documentation ” pythonic year after year ” “from colleagues “Becoming a pythonic programmer takes time ” during code review” 45

  45. Le Learn rning ' 'Pyth thonic' c'? “StackOverflow shows you multiple points of view of people, and you always learn.” “ reading code in repositories of other projects” “My code became more “saw them in documentation ” pythonic year after year ” “from colleagues “Becoming a pythonic programmer takes time ” during code review” → Pythonic not ta taught t in books or lec ectu tures → Seems eems to to cree eep in with th exp experien ence 46

  46. Do Do y you ca care? ? Do Do your r peer ers ca care? 47

  47. Do Do y you ca care? ? Do Do your r peer ers ca care? “Pythonic code is positively viewed but not required ” 48

  48. Do Do y you ca care? ? Do Do your r peer ers ca care? “Pythonic code is positively viewed but not required ” “If you're a novice Python programmer, better focus on general programming skills ” 49

  49. Do Do y you ca care? ? Do Do your r peer ers ca care? “Pythonic code is positively “Pythonic idioms can at least viewed but not required ” be used to measure a developer’s knowledge .” “If you're a novice Python programmer, better focus on general programming skills ” 50

  50. Do Do y you ca care? ? Do Do your r peer ers ca care? “Pythonic code is positively “Pythonic idioms can at least viewed but not required ” be used to measure a developer’s knowledge .” “If you're a novice Python programmer, better focus on general programming skills ” “If I learn a new idiom I add it to my toolbox and then when I touch something, I modify it and leave it better, but it’s not an obsession. 51

  51. Do Do y you ca care? ? Do Do your r peer ers ca care? “Pythonic code is positively “Pythonic idioms can at least viewed but not required ” be used to measure a developer’s knowledge .” “If you're a novice Python programmer, better focus on general programming skills ” “If I learn a new idiom I add it to my toolbox and then when I touch something, I modify it and leave it better, but it’s not an obsession. → Pythonic imp mporta tant, t, but t not fo forma mally → Pythonic signals exp exper ertise e and garners res espect 52

  52. A ca cata talogue of Py Pythonic I c Idioms ms 53

  53. A ca cata talogue of Py Pythonic I c Idioms ms ● Published ed online e at http ttp://p /pyth ythonic.libres esoft. t.info fo/c /cata talogue – including examples, references and benchmarks 54

  54. A ca cata talogue of Py Pythonic I c Idioms ms ● Published ed online e at http ttp://p /pyth ythonic.libres esoft. t.info fo/c /cata talogue – including examples, references and benchmarks ● Co Compiled ed fr from – Several books (on learning and applying Python) – Online statements by influential and renowned Python developers 55

Recommend


More recommend