I don’t know why, but setting up the build system for a new software project and maintaining it seems to be something people are always afraid of. I’ve often heard people say “Eclipse does the job. It’s just additional work.” This usually leads to confusion and a lot of bulk and weird solutions several days … Read More →
Tag Archives: Python
Difference between comparisons with == and is in Python
In Python, two operators exist to perform equality comparisons: == and is. Often you can read instructions like “When comparing to None, always use is instead of ==”, but the real reason is not explained. However, looking at the language expression specification section of the Python manual you can find the difference: “The operators is and is not test for … Read More →
Evauation of Default Arguments in Python
Today I stumbled upon a very subtle problem with default arguments in python. I noticed that loading a python module already instantiated one of my classes even though I could not find an installation of this class. In the end it turned out to be a default argument for a function:
|
1 2 |
def foo(arg=MyClass()): pass |
As I am … Read More →
PyGTK Segfault durch bereits geladenes GTK
Seit zwei Wochen bastel ich mich jetzt schon um einen mir unerklärlichen Segfault beim Importieren von PyGTK herum. Heute hab ich dann endlich mal etwas Zeit gehabt das ganze genauer unter die Lupe zu nehmen. Das Modul in meinem Projekt, das die GUI-Funktionalität bereitstellt, enthält folgende Imports: [python] import pygtk pygtk.require(’2.0′) import gtk [/python] Bis … Read More →
Style Guide für Python
Style Guides für Java und C/C++ gibt es ja zu Hauf, für Python war mir aber bisher noch kein explizit aufgeschriebener aufgefallen – zumindest bis gestern: PEP 8 — Style Guide for Python



