How to become a proficient Python programmer | Munen Alain M. Lafon Spoiler: This post is primarily gonna be an excerpt of my bookmarks collection. That’s because more intelligent men than me have already written great articles on the topic of how to become a great Python programmer. I will focus on four primary topics: Functional programming, performance, testing and code guidelines. Functional programming Writing code in an imperative style has become the de facto standard. If you don’t know what I’m talking about, that’s great. Performance There’s so much talk going on about how inefficient these ‘scripting languages’ (Python, Ruby, …) are, that it’s easy to forget that very often it’s the algorithm chosen by the programmer that leads to horrible runtime behaviour. Those articles are a great place to get a feel for the ins and outs of Python’s runtime behaviour, so you can get your high performing application writting in a language that is concise and fun to write. Testing Testing is probably one the most misjudged topics in computer science these days.
Neopythonic Откуда идут «функциональные» корни Python / Python Я никогда не полагал, что Python попадет под влияние функциональных языков, независимо от того что люди говорят или думают. Я знаком с императивными языками, такими как C и Algol68 и хотя я сделал функции объектами «первого класса», я не рассматривал Python как язык функционального программирования. Однако, было ясно, что пользователи хотят больше от списков и функций. Операции над списками применялись к каждому элементу списка и создавали новый список. Например: def square(x): return x*x vals = [1, 2, 3, 4] newvals =  for v in vals: newvals.append(square(v)) На функциональных языках, таких как Lisp и Scheme, операции, такие как эта были разработаны как встроенные функции языка. def map(f, s): result =  for x in s: result.append(f(x)) return result def square(x): return x*x vals = [1, 2, 3, 4] newvals = map(square,vals) Тонкость вышеупомянутого кода в том, что многим людям не нравился факт, что функция применяется к элементам списка как набор отдельных функций.
Probably Overthinking It: Regression with Python, pandas and StatsModels I was at Boston Data-Con 2014 this morning, which was a great event. The organizer, John Verostek, seems to have created this three-day event single-handedly, so I am hugely impressed. Imran Malek started the day with a very nice iPython tutorial. The description is here, and his slides are here. And Imran very kindly let me use his laptop to project slides for my talk, which was next. Regression is a powerful tool for fitting data and making predictions. As an example, I will use data from the National Survey of Family Growth to generate predictions for the date of birth, weight, and sex of an expected baby. This talk is appropriate for people with no prior experience with regression. And here are my slides: The material for this talk is from the second edition of Think Stats, which is in production now and scheduled for release in early November. As I expected, I prepared way more material than I could present. I believe video of the talk will be available soon.
Improving your programming style in Python -- Gaël Varoquaux: computer / data / brain science Here are some references on software development techniques and patterns to help write better code. They are intended for the casual programmer, and certainly not an advanced developer. They are listed in order of difficulty. Software carpentry These are the original notes from Greg Wilson’s course on software engineering at the university of Toronto. Software design for maintainability My own post A case of shameless plug: this is a post that I wrote a few years ago. Writing a graphical application for scientific programming using TraitsUI Building interactive graphical application is a difficult problem. General Object-Oriented programming advice Designing Object-oriented code actually requires some care: when you are building your set of abstractions, you are designing the world in which you are going to be condemned to living (or actually coding). Go Top
Code Like a Pythonista: Idiomatic Python In this interactive tutorial, we'll cover many essential Python idioms and techniques in depth, adding immediately useful tools to your belt. There are 3 versions of this presentation: ©2006-2008, licensed under a Creative Commons Attribution/Share-Alike (BY-SA) license. My credentials: I am a resident of Montreal,father of two great kids, husband of one special woman,a full-time Python programmer,author of the Docutils project and reStructuredText,an editor of the Python Enhancement Proposals (or PEPs),an organizer of PyCon 2007, and chair of PyCon 2008,a member of the Python Software Foundation,a Director of the Foundation for the past year, and its Secretary. In the tutorial I presented at PyCon 2006 (called Text & Data Processing), I was surprised at the reaction to some techniques I used that I had thought were common knowledge. Many of you will have seen some of these techniques and idioms before. These are the guiding principles of Python, but are open to interpretation. import this
Twisted Twisted is an event-driven networking engine written in Python and licensed under the open source MIT license. Twisted runs on Python 2 and an ever growing subset also works with Python 3. Twisted makes it easy to implement custom network applications. Here's a TCP server that echoes back everything that's written to it: from twisted.internet import protocol, reactor, endpoints class Echo(protocol.Protocol): def dataReceived(self, data): self.transport.write(data) class EchoFactory(protocol.Factory): def buildProtocol(self, addr): return Echo() endpoints.serverFromString(reactor, "tcp:1234").listen(EchoFactory()) reactor.run() Learn more about writing servers, writing clients and the core networking libraries , including support for SSL, UDP, scheduled events, unit testing infrastructure, and much more. Twisted includes an event-driven web server. Learn more about web application development, templates and Twisted's HTTP client. Twisted includes a sophisticated IMAP4 client library.
The Python I Would Like To See This post is surprisingly confused, it is phrased as a complaint about the language, then immediately degrades into CPython implementation specifics that have little bearing on the usability of the language itself. Ronacher should also know better than to post microbenchmarks like the one provided here, especially without corresponding (C) profiler output. At the C level, slots allow the implementation constant-time access to the most common code paths for an object, and especially when you have C code calling other C code via the type system (IMHO the primary use for Python, and still its strongest use case), "interpreter overhead" is reduced to a few extra memory indirection operations. In the alternative world, sure, perhaps some microbenchmark may behave faster, but now systemically, and for e.g. "reduce(operator.add, range(1000))" requires more hash table lookups than I can count.
www.celles.net: Python Interfaces graphiques (toolkits) pour Python Tk (TkInter) wxWidgets (wxPython) Qt PyQt - licence PySide - licence LGPL Autres Pmw Kivy - crossplatform framework for NUI (smartphone - tactile multipoint...) TraitsUI (wxPython) (PyQT) GUI Designer for TkInter Vérification / Lint Divers AFPY - Association Francophone PYthon Conférences News, Planet... Doc Livres Cloud