Delaney, Timothy (Tim) wrote: > Since we're adding the __index__ magic method, why not have a > __getindexed__ method for sequences.
I don't think this is a good idea, since it would be re-introducing all the confusion that the existence of two C-level indexing slots has led to, this time for user-defined types. > The backwards-incompatibility comes in when you have a type that > implements __getindexed__, and a subclass that implements __getitem__ I don't think this is just a backwards-incompatibility issue. Having a single syntax that can correspond to more than one special method is inherently ambiguous. What do you do if both are defined? Sure you can come up with some rule to handle it, but it's better to avoid the situation in the first place. -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | Carpe post meridiam! | Christchurch, New Zealand | (I'm not a morning person.) | [EMAIL PROTECTED] +--------------------------------------+ _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com