Transcript
Page 1: Python: The Programmer's Lingua Franca

Python: The Programmer’s Lingua Franca

Using Python to build bridges betweentechnologies, businesses and people

Page 2: Python: The Programmer's Lingua Franca

What we'll talk aboutWhat we'll talk about

• What is a lingua franca?• Why the industry needs one• Acmeism – the Ingy approach• Past and current examples: BASIC, C,

and Java• Why Python is better• TPSL: Teaching Python as a Second (or

third or fourth) Language• Getting past the barriers

Page 3: Python: The Programmer's Lingua Franca

What is a lingua franca?What is a lingua franca?

• The original “Lingua Franca” was an amalgam of languages– Made up of Italian, Arabic, French, Greek, Portuguese, Spanish and

Turkish. – Used in the Mediterranean during the Rennaissance

• English functions as the de facto modern lingua franca– For international business, aviation, science and technology

– Integrates words from other languages

• English doesn't fit the strict definition– It is often the mother tongue of at least one party...

– but this example is closer to what we'll talk about

“a language systematically used to make communication possible between people not sharing a mother tongue, in particular when it is a third language, distinct from both mother tongues.”

-- Wikipedia

Page 4: Python: The Programmer's Lingua Franca

Why do we need one for Why do we need one for programming?programming?• So many languages

– more than 2500 in all (“The Language List” Bill Kinnersley)– if you just include popular ones, you still can't learn them

all• Programmers need a vehicle to express concepts to

one another• Programs need a vehicle to interact with one another

– open data formats– standard protocols– an API everyone can use

Page 5: Python: The Programmer's Lingua Franca

5%

14%

18%

37%

27%

Number of Languages in Organization

1 language2 languages3 languages4 or more languagesUnknown or no answer

What this audience reported:What this audience reported:

Page 6: Python: The Programmer's Lingua Franca

• Inventor of YAML• Leader in the Perl Community• 100+ CPAN modules• Several PyPI Modules• Old and New “Activator”• Acmeist• Currently travelling around Europe

Ingy döt Net Ingy döt Net

Page 7: Python: The Programmer's Lingua Franca

Acmeism Acmeism

• A different path to mutual comprehension• Ideas (modules) need to be shared across all

language boundaries• Build technology that is programming language

independent– YAML – data serialization for many programming

languages– C'Dent - Acmeist Module Language– Pegex - Acmeist Parser for creating new

languages– TestML - Acmeist Unit test language (like FIT)

Page 8: Python: The Programmer's Lingua Franca

Other programming lingua francas Other programming lingua francas

• BASIC– Used to be everywhere, code samples in math and science

textbooks– Many first generation micro-computer hackers started with this

language

• C– Widely used and part of most comp-sci programs– Most experienced programmers are familiar with it– Lower-level language

• Java– Extremely popular, cross-platform, also widely taught– Very verbose– Open source (GPL) only since 2007 (c.f. Apache Harmony)

Page 9: Python: The Programmer's Lingua Franca

14%

14%

13%43%

15%

Language Used to Describe Programming Ideas

CJavaPythonOtherNo answer

... used by this audience ... used by this audience

Page 10: Python: The Programmer's Lingua Franca

Why Python is betterWhy Python is better

• Free • Easy to read

– Syntax (specifically indentation) enforces sane visual block structure

– Concise, high-level interpreted language• Easy to learn

– Excellent documentation and tutorials– Numerous training resources

• Increasingly popular– Adopted by important organizations: Google, NASA, Disney,

Sony, SEC

Page 11: Python: The Programmer's Lingua Franca

ComparisonsComparisons

Which language is most readable and concise?

– Example code adapted from http://www.dmh2000.com/cjpr/– Using object oriented C++ instead of C to be more fair

Page 12: Python: The Programmer's Lingua Franca

C++ C++ #include <iostream>#include <sstream>#include <string>#include <vector>

using namespace std;

template<class T> class RedBlackTree { private: static const int red = 0; static const int black = 1;

int m_color; T m_val; RedBlackTree *m_left; RedBlackTree *m_right;

RedBlackTree(RedBlackTree *b) { m_val = b->m_val; m_left = b->m_left; m_right = b->m_right; m_color = red; }

public: RedBlackTree(T x) { m_val = x; m_left = 0; m_right = 0; m_color = red; }

const RedBlackTree *find(const T &key) const { const RedBlackTree *result = 0; if (key == m_val) { result = this; } else if (key < m_val) { if (m_left != 0) { result = m_left->find(key); } } else { if (m_right != 0) { result = m_right->find(key); } } return result; }};

Page 13: Python: The Programmer's Lingua Franca

Java Java import java.util.*;

public class RedBlackTree<T extends Comparable<T>> { public static final int red = 0;

public static final int black = 1;

private int __color;

private T __val; private RedBlackTree<T> __left; private RedBlackTree<T> __right;

private RedBlackTree(RedBlackTree<T> b) {

__val = b.__val; __left = b.__left; __right = b.__right;

__color = red; }

public RedBlackTree(T x) { __val = x; __left = null;

__right = null; __color = red; }

public RedBlackTree<T> find(T key) { RedBlackTree<T> result = null;

if (key == __val) { result = this;

} else if (key.compareTo(__val) < 0) { if (__left != null) {

result = __left.find(key); } }

else { if (__right != null) { result = __right.find(key);

} } return result;

}}

Page 14: Python: The Programmer's Lingua Franca

Python Python class RedBlackTree:

red, black = range(2)

def __init__(self, val=None):

self.left = None

self.right = None

self.val = val

self.color = RedBlackTree.red

def find(self, key):

result = None

if (key == self.val):

result = self

elif (key < self.val):

if (self.left != None):

result = self.left.find(key)

else:

if (self.right != None):

result = self.right.find(key)

return result

Page 15: Python: The Programmer's Lingua Franca

Integration with other languagesIntegration with other languages• Python libraries are commonly written in C or C++ when

performance is a consideration• You can use other languages in Python, and Python in other

languages– Inline, PyInline, Inline::Python etc.

• More projects integrating Python with other programming languages:

– Bridges for C/C++, Java, C#/.NET, PHP, Perl, and more

... and databases... and databases• Commercial / enterprise: Oracle, SQL Server, DB2, SAP DB,

Sybase• Open source: MySQL, PostgreSQL, SQLite, redis, MongoDB

Page 16: Python: The Programmer's Lingua Franca

Alternative Python interpretersAlternative Python interpreters

Python is an open source language, implementations of Python are not controlled by a single commercial entity, as was case with Java and is the case with C#.

– Important for avoiding vendor lock-in– PSF license is very permissive

This encourages innovation and allows for alternative implementations:

– Jython: implemented in Java– Stackless Python: CPython variant– unladen-swallow: Google project for a faster Python– Iron Python: for the .NET Framework– PyPy: also focussing on speed and efficiency

Page 17: Python: The Programmer's Lingua Franca

Python as a Second LanguagePython as a Second Language

• What makes it easier to read also makes it easier to learn

• Many programmers come to Python from other languages

– lots of resources (Python wiki) for those switching– “Learning Python” by Mark Lutz and David Ascher– Ingy's anecdotal evidence

• Non-English tutorials and documentation– http://wiki.python.org/moin/Languages– there's even a Python tutorial in Esperanto!

Page 18: Python: The Programmer's Lingua Franca

Resources for developer-led initiatives to introduce and expand Python usage in your organization

• Commercial support and indemnification• Quality assured, vendor-backed builds• Python training from the best in the field• Development advice• code.activestate.com

• PyPM Index• Recipes

• Komodo Edit and IDE

How ActiveState can helpHow ActiveState can help

Page 19: Python: The Programmer's Lingua Franca

Python in the cloudPython in the cloud

Cloud application platform for Python and many others languages

– not a Platform as a Service... it's for creating your own

– based on Cloud Foundry – we've added Python support and a lot more

– supports multiple languages: Python, Perl, Ruby, Node.js, Java...

– all the Python web frameworks: Django, Bottle, Flask, Pyramid

– ... via WSGI

– deploy new applications or migrate existing ones

– http://activestate.com/cloud

Page 20: Python: The Programmer's Lingua Franca

Questions?Questions?

Page 21: Python: The Programmer's Lingua Franca

Thank You!Thank You!

Troy Topnik: [email protected]

Ingy döt Net: [email protected]

Speak to a representative about ActivePython or Python training:

[email protected]

www.activestate.com


Top Related