A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/300801.html below:

Wrapping classes

Wrapping classes Wrapping classesJeremy Sanders jeremy+complangpython at jeremysanders.net
Fri Sep 23 06:37:30 EDT 2005
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.

Jeremy

-- 
Jeremy Sanders
http://www.jeremysanders.net/

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4