Tag Archives: python

Fitting distribution by combing R and Python

The following example illustrates how to use R package with Python by using the Rpy2 package. This problem solve in this example is to fit a normal distribution on some data samples.   from rpy2.robjects import r from rpy2.robjects.packages import … Continue reading

Posted in Python | Tagged , , | Leave a comment

What is Virtualenv

Virtualenv is a tool to create isolated Python environments. Its usage could be very useful when dependencies and versions are tricky. Imagine you have an application that needs version 1 of a library, but another application requires version 2. If … Continue reading

Posted in Python | Tagged , | Leave a comment

Python: string substitution using dictionaries

A nice way to populate a string with values is to use a dictionary, which can be defined outside of the print statement. The standard way is to write >>> print "The temperature in %s is %f degrees" % (’celsius’, … Continue reading

Posted in Python | Tagged | 1 Comment

Python notes: generators

A new Python notes about Generators.

Posted in Python | Tagged | Leave a comment

Python notes: exceptions

Here is the first article in my Python notes about Exceptions.

Posted in Computer Science, Python | Tagged | Leave a comment

Python notes

I’ve started to gather Python notes that I took little by little during my different experiments with the language. Here is the main page Python notes. There is also a tinyurl for the Python tutorial link: http://tinyurl.com/d2k7bqe

Posted in Computer Science, Python | Tagged | Leave a comment

Sphinx themes and configuration file

In this post, I describe the procedure to create a new CSS theme in Sphinx, which is a tool dedicated to software documentation (and documentation in general). For an example of HTML pages generated automatically with Sphinx, you can look … Continue reading

Posted in Computer Science, Python | Tagged , , | 1 Comment

What is a Python descriptor

In Python, if any of the methods __get__, __set__, and __delete__ is defined for an object, then this object is said to be a descriptor. Descriptors are the mechanism behind properties, methods, static methods, class methods, and super(). Note that … Continue reading

Posted in Python | Tagged | Leave a comment

Sphinx and ReST syntax for Python documentation

Sphinx is a tool that ease the creation of documentation for computer languages such as Python but also C/C++. The Sphinx syntax is an extension to the ReST (or RST) syntax. The drawback is that you need to learn another … Continue reading

Posted in Python | Tagged , , | Leave a comment

Python list: difference between append and extend

When manipulating lists, you have access to two methods called append() and extend(). The former appends an object to the end of the list (e.g., another list) while the latter appends each element of the iterable object (e.g., another list) … Continue reading

Posted in Python | Tagged | 18 Comments