Adam Olsen wrote:
> Consider these two pieces of code:
> 
> if key in d:
>   dosomething(d[key])
> else:
>   dosomethingelse()
> 
> try:
>   dosomething(d[key])
> except KeyError:
>   dosomethingelse()
> 
> Before they were the same (assuming dosomething() won't raise
> KeyError).  Now they would behave differently.

I personally think they should continue to do the same thing,
i.e. "in" should return True if there is a default; in the
current proposal, it should invoke the default factory.

But that's beside the point: Where is the real example
where this difference would matter? (I'm not asking for
a realistic example, I'm asking for a real one)

Regards,
Martin
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to