On 04/05/2015 18:43, Ian Kelly wrote: > > Some other gotchas that aren't necessarily related to C/Java but can > be surprising nonetheless: > > * () is a zero-element tuple, and (a, b) is a two-element tuple, > but (a) is not a one-element tuple. Tuples are created by commas, not > parentheses, so use (a,) instead.
* {} is an empty set(), not dict(). Particularly subtle when combined with **kwargs $ python3 Python 3.4.0 (default, Apr 11 2014, 13:05:11) [GCC 4.8.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> def foo(**kwargs): ... return { (k, kwargs[k]) for k in kwargs } ... >>> foo() set() >>> foo(a=1) {('a', 1)} >>> ~Andrew -- https://mail.python.org/mailman/listinfo/python-list