[Python-Dev] PEP 455: TransformDict (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Tue Oct 8 08:21:43 CEST 2013
- Previous message: [Python-Dev] PEP 455: TransformDict
- Next message: [Python-Dev] PEP 455: TransformDict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, 8 Oct 2013 08:31:46 +1000 Nick Coghlan <ncoghlan at gmail.com> wrote:
That said, with the current plan to lower the barrier to entry for PyPI dependencies (I should have the 3.4 only ensurepip proposal written up some time this week), I think it makes sense to let this one bake on PyPI for a while.
"the current plan to lower the barrier to entry for PyPI" sounds a lot like the obsession du jour to me :-) It's not like "ensurepip" makes it cheaper / more attractive to add dependencies. It just provides a better experience for those who want to use pip (and would otherwise have installed it using an explicit download).
I think there is a potentially worthwhile generalisation here, but I'm far from sure "is-a-dict" is the right data model - for composability reasons, it feels like a "has-a" relationship with an underlying data store may make more sense.
It doesn't work. Your "underlying mapping" can show too much variation for the wrapper/proxy to have sane semantics. For example, how do you combine with a defaultdict or a WeakKeyDictionary, knowing that the wrapper/proxy has to have its own internal mapping as well?
(If performance is critical, you're going to write a dedicated type anyway, so composability and simplicity strike me as more important criteria at this point).
A dedicated CaseInsensitiveDict won't be much faster than TransformDict(str.casefold).
Regards
Antoine.
- Previous message: [Python-Dev] PEP 455: TransformDict
- Next message: [Python-Dev] PEP 455: TransformDict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]