be a zen monk, the python way
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
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.
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.
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
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”.
Henderson approves?
Zen of Python ~ Tim Peters
Meta Zen
ध्यान => झान => ch'an-na => 禪 [Zen]*
*Heinrich_Dumoulin
“Meditate on amidst your madness”
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.
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]>>>
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
Learnings
● Generators
● TCO *
● Native asynchronous operations ~ #3156 ~ Tulip
● concurrent ~ Future objects
* debatable. Or not, given BDFL's justification.
[More @ PEP list]
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.
CPython
PyPy
JPython/Jython (JVM) :: JRuby
Iron Python :: Iron Ruby
Tongues