It seems to me that this question has already been asked and answered, but I could not find anything on the topic, so excuse me if this is so. I want to determine the behavior of the brackets [] when applied to a class, similar to the construction def []=()in ruby, so that calling Python obj['foo']will actually call some method [](self, what). How can i do this?
source
share