[Python-Dev] operator.is*Type (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Thu Feb 23 05:25:34 CET 2006
- Previous message: [Python-Dev] operator.is*Type
- Next message: [Python-Dev] buildbot, and test failures
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.) | greg.ewing at canterbury.ac.nz +--------------------------------------+
- Previous message: [Python-Dev] operator.is*Type
- Next message: [Python-Dev] buildbot, and test failures
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]