The pythonic approach

Peter Hansen peter at engcorp.com
Wed Sep 15 14:38:02 EDT 2004


Alex Martelli wrote:

> Peter Hansen <peter at engcorp.com> wrote:
>>Principle of least surprise.  One rarely encounters .get(x, x)
> 
> Funny -- I encounter it SO often I consider it a basic idiom!!!

I think if the example had been one like your XML massaging
example, it wouldn't have felt very out of place, even if
I haven't seen it very often.  (I'm quite sure I've used
it myself, for the same "optional translation" characteristics,
but I guess I work in areas different enough that it hasn't
been frequent.)

-Peter



More information about the Python-list mailing list