[TIP] Mocking properties on an instance

Julian Berman julian at grayvines.com
Mon Sep 12 05:49:47 PDT 2011

> Note that I don't know what happened to the proposal or if it still stands any chance of inclusion. If it is implemented it will be done in a backwards compatible way.

Now that we've gone sufficiently offtopic, I've spoken about this with a few people before. My reaction when you said there was such a proposal was that it was a bad idea. Not because it really is one but because Python IMHO chose the wrong approach to types and the fun flavors we often need of them.

What we have right now is a need for 2 ** 3 or 2 ** 4 /different/ types, one for regular, ordered, frozen, and possibly sorted versions of /each/ of the major builtin containers (set, tuple, list, dict). This is highly unfortunate, being that at very least the regular, ordered and frozen versions of all of those are actually useful things for which we really do conceivably want to have implementations of in the stdlib I'd assume. And that's not to mention that there are often combinations that are useful which I can't imagine will ever be implemented in the stdlib, not that they couldn't be individually for a project or as third party stuff. I've had use for a frozen OrderedDict before.

What I would have hoped we'd [python would have] done instead, is to expand the protocol for containers. Something like

     set(ordered=True, frozen=False)

along with some methods; freeze/unfreeze for frozen, a keep_sorted for sorting...

I am running to work so cutting this a bit short, but yeah I guess this was part of that other "discussion" :).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1539 bytes
Desc: not available
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20110912/76a870a9/attachment-0001.bin>

More information about the testing-in-python mailing list