Steven D'Aprano <[EMAIL PROTECTED]> writes:
> map = {'a': Aclass, 'b': Bclass, 'c': Cclass}
> class_ = map.get(astring, default=Zclass)
> 
> The result I want is the class, not the result of calling the class 
> (which would be an instance). If I wanted the other semantics, I'd be 
> using defaultdict instead.

I used default as a keyward arg name indicating the presence of
a callable.  I probably should have called it defaultfunc or something.

x = d.get('a', f)      # --> default value is f
x = d.get('a', defaultfunc=f)  # --> default value is result of f() .
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to