be a zen monk, the python way

14
Current state of adopon Welcome when the focus is Rapid prototyping Machine learning, thanks to set libraries [numpy, scipy, pandas] Ease of boot up, thanks to Django's aping of Rails' scaffold paern* * Should've gone the missing mile in spoiling a new developer.

Upload: sriram-murali

Post on 27-Jun-2015

82 views

Category:

Technology


0 download

DESCRIPTION

Be a Zen monk, the Python way. A short tech talk at Imaginea to get developers bootstrapped with the focus and philosophy of Python and their point of convergence with the philosophy.

TRANSCRIPT

Page 1: Be a Zen monk, the Python way

Current state of adoption

Welcome when the focus is

● Rapid prototyping

● Machine learning, thanks to set libraries [numpy, scipy, pandas]

● Ease of boot up, thanks to Django's aping of Rails' scaffold pattern*

* Should've gone the missing mile in spoiling a new developer.

Page 2: Be a Zen monk, the Python way

What the Python community likes to see?

● Adoption of Python more for the generic nature rather than a denigrated scripting language approach.

● Work closely with VM choices depending on situations and improve on language usability/performance itself. *

* STM with PyPy / Tulip with CPython are major steps forward.

Page 3: Be a Zen monk, the Python way

History

● v 0.9.0 ~ February 1991

● v 1.0.0 ~ January 1994

● v 2.0 ~ October 2000

● v 2.6 ~ October 2008 / v 3.0 ~ December 2008

● v 2.7 ~ July 2010. Stopgap during Py3k migration

Page 4: Be a Zen monk, the Python way
Page 5: Be a Zen monk, the Python way

Focus

● Evolved more as a general purpose programming language borrowing upon features from time tested yet aging dialects.

● To quote the original snake charmer, “Borrow ideas from elsewhere whenever it makes sense.”

● And to paraphrase the Zen master, “special features to borrow aren't special enough if they break philosophy”.

Page 6: Be a Zen monk, the Python way

Henderson approves?

Page 7: Be a Zen monk, the Python way

Zen of Python ~ Tim Peters

Page 8: Be a Zen monk, the Python way

Meta Zen

ध्यान => झान => ch'an-na => 禪 [Zen]*

*Heinrich_Dumoulin

“Meditate on amidst your madness”

Page 9: Be a Zen monk, the Python way

Idiosyncrasies

● Quixotic combination of Dynamic and Strong typing paradigms.

● A strong type system bound to objects rather than variables unlike neighbors.

● GC outside scoping paradigms depending on object reference counts.

● Truth-y/False-y value checks like Javascript (though empty arrays are truth-y out there) towards the other end from Haskell.

Page 10: Be a Zen monk, the Python way

Idiosyncrasies

● Mutable default arguments

– def appender(array=[]): '''Appends a new integer 1 to an array''' array.append(1) print array

>>> for x in xrange(1, 3):… appender()…[1][1, 1]>>>

Page 11: Be a Zen monk, the Python way

Idiosyncrasies

● Typing

>>> a = 1>>> a = “Now I am a string”

Paraphrasing ratnakIrti, “It was referring to an integer and now refers to a string” *

* yat sat tat kShaNikam | yathA ghaTaH

Page 12: Be a Zen monk, the Python way

Learnings

● Generators

● TCO *

● Native asynchronous operations ~ #3156 ~ Tulip

● concurrent ~ Future objects

* debatable. Or not, given BDFL's justification.

[More @ PEP list]

Page 13: Be a Zen monk, the Python way

Testing

● Selenium.

● While not a big fan of it,

● Lettuce for BDD :: Cucumber [Ruby] :: Jasmine [JS]

● RSpec replacement ~ Thorn in the fesh. Anonymous function qualms with lambda.

● Sure/nose-of-yeti solve the problem, but a long way to go.

Page 14: Be a Zen monk, the Python way

CPython

PyPy

JPython/Jython (JVM) :: JRuby

Iron Python :: Iron Ruby

Tongues