[Python-ideas] Dict-like object with property access

Simon Sapin simon.sapin at kozea.fr
Mon Jan 30 15:48:15 CET 2012


Le 30/01/2012 15:43, anatoly techtonik a écrit :
> In which case d['clear'] != d.clear can be true?

dict.clear is a method:

 >>> import bunch
 >>> b = bunch.Bunch()
 >>> b['clear'] = 4
 >>> b['clear']
4
 >>> b.clear
<function clear>
 >>> b.clear.__doc__
'D.clear() -> None.  Remove all items from D.'

Regards,
-- 
Simon Sapin



More information about the Python-ideas mailing list