Wrapping classes

bruno modulix onurb at xiludom.gro
Fri Sep 23 06:54:53 EDT 2005


Jeremy Sanders wrote:
> Diez B. Roggisch wrote:
> 
> 
>>It works - in python 2.4!! I tried subclassing dict, but my
>>__getitem__-method wasn't called - most probably because it's a C-type,
>>but I don't know for sure. Maybe someone can elaborate on that?
> 
> 
> Yes - I tried that (see thread below). Unfortunately it needs Python 2.4,
> and I can't rely on my users having that.
> 
> Traceback (most recent call last):
>   File "test.py", line 15, in ?
>     print eval("10 * a + b", globals(), l)
> TypeError: eval() argument 3 must be dict, not Foo
> 
> If you subclass dict it doesn't call the __getitem__ method.

Could it work with a UserDict subclass ?


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list