Implicit conversion to boolean in if and while statements

Andrew Berg bahamutzero8825 at gmail.com
Tue Jul 17 06:44:02 CEST 2012


On 7/16/2012 11:11 PM, Steven D'Aprano wrote:
> If you are right that SimpleNamespace should be treated as a container, 
> then it should implement container semantics. Since it doesn't, that is 
> either:
> 
> 1) a bug; or
> 2) a triumph of laziness over correctness
> 
> I imagine though that the Python dev's answer will basically be #2: "it 
> isn't a container, it just behaves a little bit like a container, except 
> when it doesn't" kinda thing. But feel free to report it as a bug and see 
> what happens.
I'm not saying it's necessarily wrong, but I do think it quacks a lot
like a container, even though it isn't one, especially if you're
listening for quacks instead of looking for ducks.
-- 
CPython 3.3.0b1 | Windows NT 6.1.7601.17803



More information about the Python-list mailing list