November 30th, 2017

Python Does What?!: python3 set literals in 3, 2, 1….

Programing, Python, by admin.


>>> {1,2}.add(3)
>>> {1}.add(2)
>>> {}.add(1)
Traceback (most recent call last):
  File “<stdin>”, line 1, in <module>
AttributeError: ‘dict’ object has no attribute ‘add’

why no empty set literal:
https://mail.python.org/pipermail/python-3000/2006-April/001286.html
https://mail.python.org/pipermail/python-3000/2006-May/001666.html

Back Top

Leave a Reply