Browsing the archives for the python tag.

Using Python and C Together

Kategorilenmemiş

If we have an algorithm that goes really hard on the cpu, or we want to make some low level things we can implement the related area with C, and then access it from Python.

The first part of the article will cover how to call a C function from Python with the help of ctypes. In the second part, we will cover  how to run Python code from C side -sea side :P-.

First, we need to prepare out C files. Assume that we have a C function that does some sophisticated things. Related file:

Continue Reading »

Bu yazı toplamda 2516, bugün ise 0 kez görüntülenmiş

4 Comments

Advices For Python Beginners

Açık Kaynak, Programlama

This will be a brief advices-only post for a long term learning plan :)

– Use pip (python package installer), never install python packages manually
If you choose installing packages manually, you will have to deal with package dependency hell. Also if you install python packages with your OS package installer (apt-get yum etc), your python packages may be old.
– Read this! http://www.python.org/dev/peps/pep-0008/
– Don’t ever use tab for identation, a tab may mean 2 or 4 or x space characters which means your identation meaning will change if you use your code file in different environments.
– Pylint may be useful
– Learn virtualenv if you run different projects at same machine, package versions may matter a lot in some circumstances

Continue Reading »

Bu yazı toplamda 1704, bugün ise 0 kez görüntülenmiş

No Comments