[C++-sig] Re: static methods
David Abrahams
dave at boost-consulting.com
Mon Jan 13 15:48:51 CET 2003
Nikolay Mladenov <nickm at sitius.com> writes:
> David,
>
> It seems to me (I have not tested) that with your fix the following code
> will execute normaly:
> int main()
> {
> dict d;
> assert( d[0] == object() );
> return 0;
> }
No, that will throw.
int main()
{
dict d;
assert(d.get(0) == object() );
return 0;
}
> But in python:
>>>> d=dict()
>>>> d[0]
> Traceback (most recent call last):
> File("?stdin>", line1, in?
> KeyError: 0
>>>>
>>> dict().get(0) is None
1
--
David Abrahams
dave at boost-consulting.com * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution
More information about the Cplusplus-sig
mailing list