background preloader

Python

Facebook Twitter

Programming

Examples. An overview — Cython v0.13 documentation. [Cython] is a programming language that makes writing C extensions for the Python language as easy as Python itself. It aims to become a superset of the [Python] language which gives it high-level, object-oriented, functional, and dynamic programming. Its main feature on top of these is support for optional static type declarations as part of the language. The source code gets translated into optimized C/C++ code and compiled as Python extension modules. This allows for both very fast program execution and tight integration with external C libraries, while keeping up the high programmer productivity for which the Python language is well known. The primary Python execution environment is commonly referred to as CPython, as it is written in C.

Originally based on the well-known Pyrex [Pyrex], the Cython project has approached this problem by means of a source code compiler that translates Python code to equivalent C code. Flying High: OpenGL from Python, Part 2. This is second in a series of articles about algorithmically generating geometry to drive OpenGL from Python. << Back to part 1 Last time we got as far as creating some instances of our super-simple Shape class, and having Glyph and Render classes convert those to arrays for OpenGL and render them. This time, we start using that infrastructure to create some more interesting geometries, which means there’s less code, and more pretty pictures. Composite Shapes In order to create more complex shapes by composing instances of existing ones, we need a simple composite shape: A MultiShape contains a list of child Shapes, and a matrix for each child, indicating the child’s position and orientation relative to the MultiShape’s front-and-center.

This is probably as good a point as any to confess that for the purposes of this demo, I ended up writing my own Matrix class, along with my own Orientation class. There is an inefficiency to this. A cluster of cubes, rendered in one glDrawElements call. Python Web Application with Spring Python. I read the SpringPython Book about a month ago, and liked it, so about two weeks ago, started building a small web application with it in an attempt to learn more about it. I have never used Python to build anything larger than a script, so this was a first for me. One reason I haven't even tried to do a Python webapp before is that we are a Java shop, and maintainability becomes an issue. In this instance, however, I think I have a use case which just feels more natural to solve with Python than with Java.

The use case is exposing expensive computing resources to the users via a webapp. We have batch jobs that run for long periods and are fairly memory and processor intensive. Developing and running these jobs are restricted to a few people who are given access to large fast machines (or clusters in some cases). The downside (for these supposedly lucky folks) is that they often have to run jobs (often at odd hours) for people who dont have access. Customizations Multiple modes Services. Google Tłumacz. Data Structures In Python - Python Tutorials. THENSYS. Python. By Drew Conway, on July 25th, 2011 During one of our impromptu sprints at SciPy 2011 , the NetworkX team decided it would be nice to add the ability to export networks for visualization with the D3 JavaScript library . This would allow people to post their visualizations online very easily. Mike Bostock , the creator and maintainer of D3, also has a wonderful example of how to render a network using a force-directed layout in the D3 examples gallery.

So, we decided to insert a large portion of Mike’s code into the development version of NetworkX in order to allow people to quickly export networks to JSON and visualize them in the browser. Unfortunately, I have not had the chance to write any tests for this code, so it is only available in my fork of the main NetworkX repository on Github . But, if you clone this repository and install it you will have the new features (along with an additional example file for building networks for web APIs in NX).

By Drew Conway, on May 5th, 2011.