Entries Tagged as 'python'
A recurring problem in (not only) GUI programming are event cycles, i.e. the receiving of events oneself has triggered. These can quickly lead to event cycles, where change triggers change triggers change, until something gives out—usually the stack.
A particularly cheap way of breaking cycles are simple boolean flags:
class Foo(object):
listen = True
[...]
[Read more →]
Tags: python
It is possible to write custom GTK widgets that have “native” scrolling support, as opposed to just shoving them into a GtkViewPort and forgetting about them.
Apart from having mastered a small coding challenge, as it turned out to be, this also gives you greater control over the scrolling itself, like making sure that certain [...]
[Read more →]
Tags: lang:en · programming · python
Some participants of this semester’s „Computational Linguistics” course (which is a code word for „10 different lecturers guide you through the wonderful world of algorithms and theoretical foundations of CoLi”) obviously lack a life and willfully extended their own homework assignment, writing small toolkits for finite state automata.
Surprisingly, all those toolkits were written in Python [...]
[Read more →]
Tags: coli · lang:en · programming · python
Sometimes I wonder what the hell I might have been thinking while writing code like this1 :
1
2
3
4
5
6
7
def uncurry(f):
return lambda t: f(*t)
def longest_common_prefix(Sa, Sb):
return len(list(
takewhile(uncurry(eq),
[...]
[Read more →]
Tags: lang:en · programming · python
A small context manager for stating assertions about exceptions in Python unit tests:
@contextmanager
def assert_raises(*exc_types):
"""A context to ensure that an exception of a given type is thrown.
Instead of
@nose.tools.raises(ValueError)
def test_that_raises():
# … lengthy setup
[...]
[Read more →]
Tags: lang:en · programming · python
It’s only a couple of months late, but we’ve just released a new version of the Stockholm TreeAligner to an awed audience. This release features the prototype implementations of TIGERSearch and alignment queries, which will be perfected in the next release, due in March 2008.
For those who are wondering what kind of code name Gamla [...]
[Read more →]
Tags: coli · lang:en · programming · python · treealigner
As is the way with Python, it turns out that you can create the start of something useful in less that fifty lines of code.↪
I simply cannot confirm often enough how true that is.
[Read more →]
Tags: lang:en · python
Es ist soweit, und die ganze Welt der Baumdatenbanken bekommt einen Geschmack vom Stockholm TreeAligner. Joakim wird morgen ein Poster über das „Gamla Stan”-Release von STA präsentieren (Paper).
Nachdem das Release nur ein paar Monate verspätet war, machen wir uns auch gerade daran, die technische Basis mit ein paar gezielten geradezurücken. Die Hauptattraktionen für das nächste [...]
[Read more →]
Tags: coli · lang:de · projects · python
I have tried to optimize the TigerXML parser in STA [↪] a bit, the results (graphs are stored in memory, with a 55 MiB corpus, on my Core 2 Duo 2.2GHz):
unoptimized: 61.01s
optimized: 39.68s
That still seemed a bit too slow to me, and I decided to try out some parallelization: since the ID reference remapping and [...]
[Read more →]
Tags: lang:en · programming · python · tech
Die IDE an sich
Nach einem Jahr verschärftem Toolmonkeyism auf der Arbeit bin ich zu der Überzeugung gelangt, dass auch beim Python-Programmieren ein wenig IDE-Unterstützung nicht schlecht wäre. Eclipse (besonders das erstaunlich stabile 3.3) wächst einem dann doch ans Herz. Nicht dass ich für Python unbedingt Ctrl-1 bräuchte (z.b. den infernalischen Java-Typinferenz-Hack, Variablen ohne Typ zu [...]
[Read more →]
Tags: lang:de · programming · python · tech