background preloader

Dive Into Python 3

Dive Into Python 3
You are here: • Dive Into Python 3 Dive Into Python 3 covers Python 3 and its differences from Python 2. Compared to Dive Into Python, it’s about 20% revised and 80% new material. The book is now complete, but feedback is always welcome. Table of Contents (expand) Also available on dead trees! The book is freely licensed under the Creative Commons Attribution Share-Alike license. you@localhost:~$ git clone © 2001–11 Mark Pilgrim Related:  Python ExercicesPython & VIM Resources

ICFP Programming Contest The ICFP Programming Contest is an international programming competition held annually around June or July since 1998, with results announced at the International Conference on Functional Programming. Teams may be of any size and any programming language(s) may be used. There is also no entry fee. Participants have 72 hours to complete and submit their entry over the Internet. There is often also a 24-hour lightning division. The contest usually have around 300 submitted entries.[1][2] Past tasks[edit] Prizes[edit] Prizes have a modest cash value, primarily aimed at helping the winners to attend the conference, where the prizes are awarded and the judges make the following declarations: First prize [Language 1] is the programming tool of choice for discriminating hackers. Second prize [Language 2] is a fine programming tool for many applications. Third prize [Language 3] is also not too shabby. Winner of the lightning division [Language L] is very suitable for rapid prototyping. Judges' prize

[PYTHON3] Invent with Python Full Stack Python Building Skills in Python — S.Lott v4.2 Site How do you learn Python? By doing a series of exercises, each of which adds a single new feature of the language. This 450+ page book has 42 chapters that will help you build Python programming skills through a series of exercises. This book includes six projects from straight-forward to sophisticated that will help solidify your Python skills. The 2.6 edition was significantly revised and expanded to cover Python 2.6 and some elements of Python 3.1. The current release has benefitted from a great deal of support from readers who sent detailed lists of errors and suggestions. Professional programmers who need to learn Python are this book’s primary audience. Since Python is simple, we can address newbie programmers who don’t have deep experience in a number of other languages.

[PYTHON] Fundamentals: Creating a Pypet Python Programming Fundamentals Introduction About this Guide This guide was created for complete beginners (i.e. with no programming or computer science experience) and will teach you programming fundamentals in a language called Python. Following a project-driven learning philosophy you will learn as you build your own project. As you complete this guide you'll be creating a virtual pet we'll call "Pypet" (a "Python-pet"). There are no software or computer requirements for this guide except that you need access to a web browser (which you obviously already have at this point). What is Python? Python is a scripting programming language known for both its simplicity and wide breadth of applications. Many Python programmers (aka “Pythonistas”) love this language because it maintains a certain philosophy of best practices, described in Tim Peter’s famous “Zen of Python”. Get notified when new guides are released Setup Getting your Nitrous Environment Running Running Python for the first time

Python’s super() considered super! | Deep Thoughts by Raymond Hettinger If you aren’t wowed by Python’s super() builtin, chances are you don’t really know what it is capable of doing or how to use it effectively. Much has been written about super() and much of that writing has been a failure. This article seeks to improve on the situation by: providing practical use casesgiving a clear mental model of how it worksshowing the tradecraft for getting it to work every timeconcrete advice for building classes that use super()favoring real examples over abstract ABCD diamond diagrams. The examples for this post are available in both Python 2 syntax and Python 3 syntax. Using Python 3 syntax, let’s start with a basic use case, a subclass for extending a method from one of the builtin classes: class LoggingDict(dict): def __setitem__(self, key, value):'Setting %r to %r' % (key, value)) super(). This class has all the same capabilities as its parent, dict, but it extends the __setitem__ method to make log entries whenever a key is updated. Search Order

Planet Python [PYTHON] Beginners Guide: NonProgrammers Python for Non-Programmers If you've never programmed before, the tutorials on this page are recommended for you; they don't assume that you have previous experience. If you have programming experience, also check out the BeginnersGuide/Programmers page. Books Each of these books can be purchased online and is also available as a completely free website. Automate the Boring Stuff with Python - Practical Programming for Total Beginners by Al Sweigart is "written for office workers, students, administrators, and anyone who uses a computer to learn how to code small, practical programs to automate tasks on their computer." Interactive Courses These sites give you instant feedback on programming problems that you can solve in your browser. CheckiO is a gamified website containing programming tasks that can be solved in either Python 2 or 3. K-12 Oriented (for Children) Build a "Pypet" Learn programming fundamentals in Python while building a tamagotchi style "Pypet" by Tatiana Tylosky. Videos

A Guide to Python's Magic Methods « Rafe Kettler Copyright © 2012 Rafe Kettler Version 1.17 A PDF version of this guide can be obtained from my site or Github. The magic methods guide has a git repository at Any issues can be reported there, along with comments, (or even contributions!). Table of Contents Introduction This guide is the culmination of a few months' worth of blog posts. What are magic methods? So, to fix what I perceived as a flaw in Python's documentation, I set out to provide some more plain-English, example-driven documentation for Python's magic methods. I hope you enjoy it. Construction and Initialization Everyone knows the most basic magic method, __init__. __new__(cls, [...) __new__ is the first method to get called in an object's instantiation. __init__(self, [...) The initializer for the class. __del__(self) If __new__ and __init__ formed the constructor of the object, __del__ is the destructor. Making Operators Work on Custom Classes Comparison magic methods

Apprendre à programmer avec Python/Classes, méthodes, héritage Un livre de Wikilivres. Livre à fractionner À faire... Les classes que nous avons définies dans le chapitre précédent ne sont finalement rien d'autre que des espaces de noms particuliers, dans lesquels nous n'avons placé jusqu'ici que des variables (les attributs d'instance). Il nous faut à présent doter ces classes d'une fonctionnalité. L'idée de base de la programmation orientée objet consiste en effet à regrouper dans un même ensemble (l'objet) à la fois un certain nombre de données (ce sont les attributs d'instance) et les algorithmes destinés à effectuer divers traitements sur ces données (ce sont les méthodes, c'est-à-dire des fonctions encapsulées). Objet = [ attributs + méthodes ] Considérons par exemple un widget « bouton ». Définition d'une méthode[modifier | modifier le wikicode] Pour illustrer notre propos, nous allons définir une nouvelle classe Time, qui nous permettra d'effectuer toute une série d'opérations sur des instants, des durées, etc Définition concrète d'une méthode

VIM Adventures Python and the Principle of Least Astonishment written on Saturday, July 9, 2011 When you use something for a long time you will develop some kind of sensing of what goes together and what does not appear to fit the common pattern. The Python community seems to have given this effect a name: if something matches the common patterns it's “pythonic” if it's not, it's deemed “unpythonic”. However if you ask beginners in Python where the language does not behave as expected you will get tons of results. I guess it would make a lot more sense to teach Python to experienced programmers by showing them how the idioms in the language work, more than what control structures there are in Python. I think Python does an amazing job by making people look at the broader picture instead of boring implementation details. Why are you Astonished? But let's assume for a moment that we are talking to a hypothetical new Python developer that has extensive knowledge in Ruby and Java. How is it in Ruby? How is it in Python? Protocols Seemingly Inverse Logic

The Python Standard Library While The Python Language Reference describes the exact syntax and semantics of the Python language, this library reference manual describes the standard library that is distributed with Python. It also describes some of the optional components that are commonly included in Python distributions. Python’s standard library is very extensive, offering a wide range of facilities as indicated by the long table of contents listed below. The Python installers for the Windows platform usually include the entire standard library and often also include many additional components. In addition to the standard library, there is a growing collection of several thousand components (from individual programs and modules to packages and entire application development frameworks), available from the Python Package Index.