diff --git a/native-datatypes.html b/native-datatypes.html index 3f8cf55..044e74c 100755 --- a/native-datatypes.html +++ b/native-datatypes.html @@ -478,7 +478,7 @@ IndexError: pop from empty list
Don’t have any values yet? Not a problem. You can create an empty set. +
Don’t have any values yet? Not a problem. You can create an empty set.
>>> a_set = set() ① diff --git a/porting-code-to-python-3-with-2to3.html b/porting-code-to-python-3-with-2to3.html index 7095d1d..19bba43 100644 --- a/porting-code-to-python-3-with-2to3.html +++ b/porting-code-to-python-3-with-2to3.html @@ -1260,7 +1260,7 @@ except:-
set()literals (explicit)In Python 2, the only way to define a literal set in your code was to call
set(a_sequence). This still works in Python 3, but a clearer way of doing it is to use the new set literal notation: curly braces. (Dictionaries are also defined with curly braces, which makes sense once you think about it, because dictionaries are just sets of key-value pairs.) +In Python 2, the only way to define a literal set in your code was to call
set(a_sequence). This still works in Python 3, but a clearer way of doing it is to use the new set literal notation: curly braces. This works for everything except empty sets, because dictionaries also use curly braces, so{}is an empty dictionary, not an empty set.☞The
2to3script will not fixset()literals by default. To enable this fix, specify -f set_literal on the command line when you call2to3.