[New-bugs-announce] [issue15289] Adding __getitem__ as a class method doesn't work as expected

samwyse report at bugs.python.org
Sat Jul 7 21:47:57 CEST 2012


New submission from samwyse <samwyse at gmail.com>:

I'm using a class as a decorator, and saving information in a class variable.  I wanted to access the information via a __getitem__ class method, but using conventional syntax doesn't work on a class.  The following exception is thrown when the attached script is run.

Traceback (most recent call last):
  File "/Users/sam/Documents/forth.py", line 34, in <module>
    print Alias["f'"]
TypeError: 'type' object has no attribute '__getitem__'

----------
components: None
files: 20120607.py
messages: 164926
nosy: samwyse
priority: normal
severity: normal
status: open
title: Adding __getitem__ as a class method doesn't work as expected
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file26309/20120607.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15289>
_______________________________________


More information about the New-bugs-announce mailing list