![](https://secure.gravatar.com/avatar/de311342220232e618cb27c9936ab9bf.jpg?s=120&d=mm&r=g)
April 7, 2016
3 p.m.
On 04/07/2016 06:46 AM, Émanuel Barry wrote:
__index__ is meant to return the same thing as __int__, and I think the same restrictions should apply here
Do you mean "the same thing" as in both return 'int', or "the same thing" is in __int__(3.4) == __index__(3.4) ? Because that last one is False.
- we have an object pretending to be a string, so there should *not* be a difference between use_as_string(obj) and use_as_string(str(obj))
Hmmm -- so maybe you are saying that if the results of __str__ and __tostring__ are the same we're fine, just like if the results of __int__ and __index__ are the same we're fine? Otherwise an error is raised. Sounds reasonable. -- ~Ethan~