Python Function Snippets


04 December, 2011   

Example of If Statement in python

04 December, 2011   

This snippet represents a simple deserializer of some basic Python types.

Python has no equivalent to Java's "super" keyword (so that some part of a method can be delegated to the superclass), but it's easy to get similar convenience despite Python's multiple-inheritance generality.

03 August, 2013   

Example shows bash code to change CWD to file's directory

Python code example for Grid made by the Label with Raised border

08 January, 2014   

Simple Python IRC bot by Berend.

28 June, 2012   

Function to generate soundex code for any string (usually a name). Conforms to Knuth's algorithm and the common Perl implementation.

11 October, 2012   

Python code example for Grid made by Label and Entry

25 February, 2013   

AppleScript code example to restart Django development server

The pyperl dist provide an interface to the Perl DBI (dbi.py). This allow direct access to all the perl supported databases from python. Full documentation of the API from 'perldoc DBI' or the ORA "Programming the Perl DBI" book, by A. Descartes and T. Bunce.

04 July, 2011   

Here are the Python code Checkbox menu

The example below shows how to produce a png image from python code, but pygments supports lexers for many other languages and its formatter classes can produce other image formats too. The ImageFormatter class allows to set various parameters of the resulting images.

Python functions are naturally polymorphic on their arguments, and checking argument types loses polymorphism

31 May, 2015   

Enhanced for loop is useful when scanning the array instead of using for loop.

18 August, 2011   

The example Python code to Rotate sequences left or right

C++ code snippet for function pointer to member function of class

Example source code for function pointer to member function of class

04 July, 2011   

Animation with threads by John E. Grayson

In Delphi, procedural types (method pointers) allow you to treat procedures and functions as values that can be assigned to variables or passed to other procedures and functions. Here's how to call a function (or procedure) as a parameter of another function (or procedure) : Declare the function (or procedure) that will be used as a...

12 August, 2012   

Simple but utilitarian function returns a numeric array of associative arrays containing an entire result set.