This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients cheryl.sabella, terry.reedy
Date 2018-02-20.23:33:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
StringTranslatePseudoMapping (Mapping) is an awkward and not very descriptive name.  It is similar to collections.defaultdict except that it uses a default value rather than a default factory.  The latter is so defaults can be mutables.  Would a subclass of similar to defaultdict be faster?

Unlike, defaultdict, the initialized default is used in get as well as __getitem__.  This means that STPM.get ignores a passed-in default, contrary to the definition of Mapping.get.  The method override is not needed.

The internal self._get is only needed because it is called in both __getitem__ and get.  Without the get override, it's body (with 'self.' added, can become the body of __getitem__.  I suspect that this would make __getitem__ faster.  Test this.
Date User Action Args
2018-02-20 23:33:06terry.reedysetrecipients: + terry.reedy, cheryl.sabella
2018-02-20 23:33:06terry.reedysetmessageid: <>
2018-02-20 23:33:06terry.reedylinkissue32880 messages
2018-02-20 23:33:06terry.reedycreate