crée vos logiciels - Le blog: Logiciels, Web, Python, Javascript ... Je voulais le temps de cet article évoquer le framework Django qui permet de développer des applications Internet rapidement. C'est la technologie utilisée pour ce site et je dois dire que j'ai pu confirmé combien Django facilite le développement d'une application web et rend cette tâche agréable. Django tire son nom du guitariste Jazz Django Reinhardt, sans doute le plus grand guitariste du 20ème siècle. Il y aurait tant à dire de ce guitariste génial dont la musique a inspiré le jazz manouche comme personne d'autres. Est-ce que son utilisation garantie de devenir un virtuose du web? Django s'occupe du SQL pour vous Django intègre un ORM (Mapping Objet-Relationnel) qui permet de manipuler simplement une base de données comme un simple objet Python. class Entry(models.Model): title = models.CharField(_('title'), max_length=255) author = models.ForeignKey('auth.User', verbose_name=_('author')) category = models.ForeignKey(Category, verbose_name=_('category')) ...
Functional Programming HOWTO In this document, we’ll take a tour of Python’s features suitable for implementing programs in a functional style. After an introduction to the concepts of functional programming, we’ll look at language features such as iterators and generators and relevant library modules such as itertools and functools. Introduction This section explains the basic concept of functional programming; if you’re just interested in learning about Python language features, skip to the next section on Iterators. Programming languages support decomposing problems in several different ways: Most programming languages are procedural: programs are lists of instructions that tell the computer what to do with the program’s input. The designers of some computer languages choose to emphasize one particular approach to programming. In a functional program, input flows through a set of functions. Functional programming can be considered the opposite of object-oriented programming. Formal provability Modularity Iterators
pydanny's django-uni-form at master - GitHub Web programmer blog Откуда идут «функциональные» корни 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) Тонкость вышеупомянутого кода в том, что многим людям не нравился факт, что функция применяется к элементам списка как набор отдельных функций.
Python Datastructures Backed by Redis @ Irrational Exuberance I've been working with Redis quite a bit at work lately, and I've really taken to it. At some point it occurred to me that it would be terribly straightforward to use Redis as the backend for the most common Python datastructures, lists and dictionaries. Not only easy, but doing so would even provide some benefits: readability, distribution across processes/threads/machines, and familiarity with the existing interfaces. The code resulting from these ideas is available on Github. Before you run off, let's consider a few simple but powerful applications of this approach: a shared configuration mechanism and ye olde publisher-consumer example. Shared Configuration Once you start working at scale, managing shared configuration data becomes an increasingly important problem. Pretty straightforward. Distributed Producers and Consumers At a certain point most architectures are in dire need of a message queue. Ok.
untitled These are the basic points we’ll cover. I’ll give a quick introduction to some of the philosophies behind Django, and talk a little bit about how to get Django up and running. I won’t really spend a whole lot of time on either of those topics, though both are quite well documented on the website. So the bulk of this tutorial will be spent on what I like to think of as the three main legs that Django stands on: Models, Views, and Templates (“MTV”). Along the way we’ll cover two of the coolest advanced features of Django: the automatic admin interface, and something called “generic views” that will save you a boatload of time. And if there’s time, I’ll talk about a bunch of little but cool features that might save you time.
The History of Python