pymongo and attribute dictionaries

Ian Kelly ian.g.kelly at gmail.com
Wed Feb 4 19:19:39 EST 2015


On Wed, Feb 4, 2015 at 3:38 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> Travis Griggs wrote:
>> This just does not roll of the fingers well. Too many “reach for modifier
>> keys” in a row.
>
> *One* modifier key in a row is too many?
>
> s o m e SHIFT D o c [ ' SHIFT _ i d ' ]

I think the point was meant to be the number of keys that need to be
reached for, not just the number of times Shift needs to be pressed.

> Extending this to wrap methods of classes is also left as an exercise.
> (Hint: don't subclass. Search the ActiveState Python recipes for "automatic
> delegation" by Alex Martelli.)

Do you mean this one?

http://code.activestate.com/recipes/52295-automatic-delegation-as-an-alternative-to-inherita/

That's based on old-style classes. With new-style classes it fails to
delegate dunder methods like __str__. That recipe should be considered
obsolete.



More information about the Python-list mailing list