[Python-Dev] Dict access with double-dot (syntactic sugar)

skip at pobox.com skip at pobox.com
Thu Mar 24 21:50:28 CET 2011


 Greg> Either you have a mostly-fixed set of field names, in which case
 Greg> you should be using a custom class instead of a dict, or the set
 Greg> of keys is dynamic, in which case you're mostly indexing with
 Greg> computed values. Lots of somedict['foo'] appearing is a code
 Greg> smell.
Unless, as I suspect, given the first message in the thread, the dict is
arriving via JSON. Doesn't that only support the most basic builtin scalar
and container types? You couldn't transfer class instances over JSON could
you? As with XML-RPC I suspect your best fallback is a dictionary.
Skip


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /