background preloader

Pyglet

Pyglet

Python: Myths about Indentation There are quite some prejudices and myths about Python's indentation rules among people who don't really know Python. I'll try to address a few of these concerns on this page. "Whitespace is significant in Python source code." No, not in general. Also, the exact amount of indentation doesn't matter at all, but only the relative indentation of nested blocks (relative to each other). Furthermore, the indentation level is ignored when you use explicit or implicit continuation lines. Of course, most of the time you will want to write the blocks in separate lines (like the first version above), but sometimes you have a bunch of similar "if" statements which can be conveniently written on one line each. If you decide to write the block on separate lines, then yes, Python forces you to obey its indentation rules, which simply means: The enclosed block (that's two "print" statements and one assignment in the above example) have to be indented more than the "if" statement itself.

Introdução à OpenGL - Profa. Isabel H. Manssour OpenGL não é uma linguagem de programação, é uma poderosa e sofisticada API (Application Programming Interface) para criação de aplicações gráficas 2D e 3D. Seu funcionamento é semelhante ao de uma biblioteca C, uma vez que fornece uma série de funcionalidades. Normalmente se diz que um programa é baseado em OpenGL ou é uma aplicação OpenGL, o que significa que ele é escrito em alguma linguagem de programação que faz chamadas a uma ou mais bibliotecas OpenGL. As aplicações OpenGL variam de ferramentas CAD a programas de modelagem usados para criar personagens para o cinema, tal como um dinossauro. Ao invés de descrever a cena e como ela deve parecer, quando se está utilizando OpenGL é preciso apenas determinar os passos necessários para alcançar a aparência ou efeito desejado. A palavra pipeline é usada para descrever um processo que pode ter dois ou mais passos distintos. Figura 1.1 - Versão simplificada do pipeline OpenGL

Python code complexity micro-tool One of the side-effects of going to PyCon is getting immersed in some side project or other. Being immersed in all things Python for a few days away from the other usual complexities of life makes it a natural environment in which to dive deep. This PyCon, I was ignited by a comment Matt Harrison made about there not being a tool to find code paths in Python. Having wrestled with the difficulty of analyzing Python code for coverage.py, I thought I could hack something together. A few days later, the meager result is codepaths.py. This will make a PNG file, for instance: python codepaths.py -d mycode.py | dot -Tpng -o mycode.png Weaknesses: It's a quick hack starting point. Khan Academy Unifying types and classes in Python 2.2 Python Version: 2.2.3 Guido van Rossum This paper is an incomplete draft. I am soliciting feedback. If you find any problems, please write me at guido@python.org. Table of Contents Change Log Changes since the original Python 2.2 version of this tutorial: Don't scare people by suggesting classmethod may go away. (4-Apr-2002) Introduction Python 2.2 introduces the first phase of "type/class unification". This is one of the biggest changes to Python ever, and yet it can be done with very few backwards incompatibilities. A bit of terminology: "classic Python" refers to Python 2.1 (and its patch releases such as 2.1.1) or earlier versions, while "classic classes" refer to classes defined with a class statement that does not have a built-in object amongst its bases: either because it has no bases, or because all of its bases are classic classes themselves - applying the definition recursively. Classic classes are still a special category in Python 2.2. Subclassing built-in types Which reminds me.

aiqus: the student driven ai-class Q&A platform welcome to Mako! Up the tata without a tutu by Joel Spolsky Saturday, December 02, 2000 Until yesterday, the FogBUGZ license said that you couldn't reverse engineer the program, attempt to look at the source code, or modify it in any way. Various honest people have asked how much we charge for a source license, so that they could customize a few things. Hmmm. Way back in 1995, I was working at Viacom, where a small group of us hardy pioneers were building web sites for various Viacom properties. In those days, there were no application servers. A brave company called Illustra started telling people that their database management system was perfect for the web. A colleague of mine at Viacom was put in charge of building an ecommerce site so that Blockbuster could sell, I kid you not, CDs on the web. Unfortunately, disaster struck. "Please can I not use Illustra?" "Well, OK, but what are you going to use instead?" And my reputation was on the line. When I sit down to architect a system, I have to decide which tools to use.

Extreme Programming: A Gentle Introduction. assertNoDiff I recently had to test output that consisted of a long list of dicts against an expected set. After too many long debugging sessions with copious print statements and lots of hand-comparison, I finally got smart and switched to using Python's builtin difflib to give me just the parts I was interested in (the wrong parts). With difflib and a little pprint magic, a failing test now looks like this: ...and I can now easily see that the "Received" data is missing the last dict in the "Expected" list. The get_diff_msg function is broken out to allow a test method to call self.fail(msg), where 'msg' might be the join'ed output of several diffs. Happy testing!

The science of computing and the engineering of software (Sir To Tags: europython2009, europython In his younger days he worked on an Algol 60 compiler. It was much better than the legacy language of the time, Fortran, of course. Fortran was 4 years old at that time :-) Science of computing or engineering of software: does any of those two exist? There’s a scale from science to engineering. Some differences between the two, scientists and engineers: Science is more long-term. Sir Tony assumes most of us present at Europython to be software engineers. But what about the science of computing? What does it do? One day... Software will be the most reliable component of every product that contains it.Software engineering will be the most dependable of all engineering professions. All this goodness happens because of the successful application of research into a) the science of programming and b) the engineering of software. Question: is there research that can help marketing come up with specifications so that we engineers can build the software?

Ars Technica: Title - Page 6 - (6/2002) Part I: Basic Computing Concepts by Jon "Hannibal" Stokes The programming model and the ISA Back in the bad old days, programmers had to enter programs directly in machine language (after having walked five miles in the snow uphill both ways). Once memory sizes and processing power increased to the point where programmer time and effort was valuable enough relative to computing time and memory space, computer scientists devised ways of allowing the computer use a portion of its power and memory to take on some of the burden of making its cryptic input and output a little more human-friendly. In order to write assembly language programs for a machine, you have to have am understanding of the machine's available resources, i.e. how many registers it has, what instructions it supports, etc. By now, most of the parts of the diagram above should be familiar to you. An instruction fetch is really a specific type of LOAD that the processor executes automatically for each line of code.

Related: