Problem with peak.rules and Python < 2.5

Christoph Zwerschke <[email protected]>
Newsgroups gmane.comp.python.peak
Message-ID <[email protected]>
Please have a look at the following code:

----------------------------

import sys
from peak.rules import when

class X:
     pass

class Y(X):
     pass

x = Y()

f = lambda x: "f"

g = when(f, "isinstance(x, X)")(lambda x: "g")

print sys.version.split()[0], isinstance(x, X), f(x)

-----------------------------

It is expected to print "g", but it prints "f" for Python < 2.5:

2.3.5 True f
2.4.4 True f
2.5.2 True g

It seems "isinstance" does not work with multilevel inheritance in 
peak.rules for Py < 2.5. Is this a known problem? Can it be fixed?

-- Christoph
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.