Comments on: The Semantics of Dictionaries, Maps and Hashtables http://gen5.info/q/2008/07/17/the-semantics-of-dictionaries-maps-and-hashtables/ Towards Intelligent Systems Wed, 11 Jul 2012 12:59:08 +0000 hourly 1 http://wordpress.org/?v=3.0.3 By: Paddy3118 http://gen5.info/q/2008/07/17/the-semantics-of-dictionaries-maps-and-hashtables/comment-page-1/#comment-574 Paddy3118 Fri, 18 Jul 2008 00:27:47 +0000 http://gen5.info/q/?p=37#comment-574 P.S. Python has the defaultdict type that is a dict with a user-defined default value. See http://jtauber.com/blog/2008/02/27/evolution_of_default_dictionaries_in_python/ - Paddy. P.S. Python has the defaultdict type that is a dict with a user-defined default value. See http://jtauber.com/blog/2008/02/27/evolution_of_default_dictionaries_in_python/

- Paddy.

]]>
By: Paddy3118 http://gen5.info/q/2008/07/17/the-semantics-of-dictionaries-maps-and-hashtables/comment-page-1/#comment-573 Paddy3118 Fri, 18 Jul 2008 00:13:49 +0000 http://gen5.info/q/?p=37#comment-573 Early on, you state: " When you expect to look up undefined values, " Do you mean: " When you expect to look up undefined keys " - Paddy. Early on, you state:

When you expect to look up undefined values,

Do you mean:

When you expect to look up undefined keys

- Paddy.

]]>
By: wekempf http://gen5.info/q/2008/07/17/the-semantics-of-dictionaries-maps-and-hashtables/comment-page-1/#comment-572 wekempf Thu, 17 Jul 2008 19:51:28 +0000 http://gen5.info/q/?p=37#comment-572 Uninitialized locals in C# don't have the problem your worried about. The compiler will issue an error (not a warning, but an error) if you attempt to use an uninitialized variable. This is an interesting post. There's some minor things I could debate, but overall, not a bad analysis. In the end, I believe .NET got this part of the interface mostly correct. There's no unsafe corner cases to be aware of (beyond the debate about null values, which I find to be a pointless debate). TryGetValue allows you to optimally attempt to get a value (this isn't so much about being an atomic operation, which in fact is not the case for Dictionary, but about not requiring two expensive lookups by using Contains followed by indexing). The only real complaint with TryGetValue is that it's usage is overly verbose, and in many cases a GetValue such as you provided would be simpler to consume. I'd argue, though, that an interface without TryGetValue would be even less optimal then an interface without GetValue. Uninitialized locals in C# don’t have the problem your worried about. The compiler will issue an error (not a warning, but an error) if you attempt to use an uninitialized variable.

This is an interesting post. There’s some minor things I could debate, but overall, not a bad analysis. In the end, I believe .NET got this part of the interface mostly correct. There’s no unsafe corner cases to be aware of (beyond the debate about null values, which I find to be a pointless debate). TryGetValue allows you to optimally attempt to get a value (this isn’t so much about being an atomic operation, which in fact is not the case for Dictionary, but about not requiring two expensive lookups by using Contains followed by indexing). The only real complaint with TryGetValue is that it’s usage is overly verbose, and in many cases a GetValue such as you provided would be simpler to consume. I’d argue, though, that an interface without TryGetValue would be even less optimal then an interface without GetValue.

]]>

Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname in /hosting/sites/gen5.info/htdocs/q/wp-includes/class-snoopy.php on line 1148

Warning: fsockopen(): unable to connect to :80 (php_network_getaddresses: getaddrinfo failed: No address associated with hostname) in /hosting/sites/gen5.info/htdocs/q/wp-includes/class-snoopy.php on line 1148