Eric Snow <ericsnowcurren...@gmail.com> added the comment: This appears to be a misunderstanding about special-method lookup which, honestly, isn't super obvious at first. It helps to remember that classes are objects like everything else in Python and thus are instances of some type (their metaclass).
Anyway, here's the key point regarding special-method lookup. As far as Python is concerned, the following are equivalent: value = obj[key] and value = type(obj).__getitem__(obj, key) Thus Alias()["f'"] will give you your answer, but Alias["f'"] tries to call type(Alias).__getitem__(Alias, key). Since Alias is a class, it is an instance of the built-in type class, so type(alias) is type, which does not have a __getitem__() method. Check out the following resources: http://docs.python.org/py3k/reference/datamodel.html#special-method-names http://docs.python.org/py3k/library/inspect.html#fetching-attributes-statically ---------- nosy: +eric.snow _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15289> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com