Idiomatic Programming - Getting the best out of your Python code
by Anand B Pillai (speaking)
Objective
A worskhop that would introduce the many facets of idiomatic programming with Python.
My hope and expectation for this session is - after one attends it, one would have the incentive to write clean, idiomatic Python code making use of its many data structures in the best, optimal and efficient way possible.
We would cover basics - including lists, tuples, dictionaries and go all the way to functional programming, function currying and (if time permits), the collections module.
I see two other talk proposals suggesting a similar theme - hence I have made mine into a workshop.
Description
In my many long years of experience with coding - with Python and other languages, I have seen that most people pick up languages based on their past experience. While this is good to get a quick start on a language, as time passes it constraints the skills one picks up on the language, because one tends to see what one has already seen.
Python is a very versatile language which allows one to program in a multitude of styles. One can choose a pure imperative C style, a pure functional style, an OOP style (aka Java) or a mix of styles. However, what matters is the way one takes advantage of the data structures in the language and writes optimal code in them.
Quite often, even experienced programmers tend to get stuck in a rut of coding style. In Python which is a dynamic language both in its runtime and the way it develops, many features allow one to get things done quickly and more efficiently if one understands the "Pythonic" way of doing it. However, one more often that not, tends to see Python code getting written in "C" style or (worse) "Java" or (horrible) Perl style.
The session will try and cover a number of common aspects and introduce many tricks and trades of the professional Python programmer to get to one object - "Writing clean, idiomatic, efficient code in Python".
Requirements
- A laptop with the latest Python 2.x installed.
- Python >= 2.6.x , 2.7.x is advised.
- My sessions would use ipython-notebook so would be nice if the participants can install at as I would upload the ipynb files here before the session.
Speaker bio
Long-time developer, Python coder, coding since 1998 in a variety of languages and platforms.
Started off with C/C++, went through Java, Lisp, Perl and finally settled at Python and been there ever since.
Founder of BangPypers, Co-ordinator of PyCon India since its early days.
Currently works as Independent Consulting Software Architect/Developer.
My interests are mainly in the back-end - Servers, Cloud computing, Python web frameworks, Apache/PHP, Iaas, SaaS and almost anything Pythonic.
Links
- My Slides are at http://pythonhacker.in/python/talks/pyconindia2013/idiomatic.html .
- Interested participants can peruse through Raymond H's talk on the same topic given in this year's PyCon US, which is an inspiration to this talk.
1
▼
I have posted the Presentation at,
http://pythonhacker.in/python/talks/pyconindia2013/idiomatic.html
The examples can be downloaded at,
http://pythonhacker.in/python/talks/pyconindia2013/examples.zip
The problems source code can be download at,
http://pythonhacker.in/python/talks/pyconindia2013/problems.zip
1
▼
Somebody recently I talked to told me,
"Hey, I heard you are going to talk about Idiomatic Python. Great. People in my company still don't follow PEP8."
Well, thank you - I agree PEP8 is a great guideline to follow. But the point is, I am not talking about "Idiomatic Python" with regards to coding style, white-space or width of your code columns. You can read it yourselves from the web.
The "Idiomatic Python" I am going to talk about are Idioms with respect to using the data structures and amazing modules of Python. We would be mainly focusing on things like,
Along the while, we will be learning about making the best use of the great modules in Python such as,
So now you know what you have signed up for. And don't ask me about PEP8 :)