« Programmation Python/Ensembles » : différence entre les versions

Contenu supprimé Contenu ajouté
Page créée avec « <noinclude>{{Python}}</noinclude> == Définition == En Python, les {{w|Ensemble (informatique)|ensembles}} sont définis par le mot <code>set()</code><ref>https://docs.py... »
 
Aucun résumé des modifications
Ligne 4 :
En Python, les {{w|Ensemble (informatique)|ensembles}} sont définis par le mot <code>set()</code><ref>https://docs.python.org/2/library/stdtypes.html#set</ref>.
 
 
{{à traduire}}
Starting with version 2.3, Python comes with an implementation of the mathematical set. Initially this implementation had to be imported from the standard module <tt>set</tt>, but with Python 2.6 the types set and [[#frozenset|frozenset]] became built-in types. A set is an unordered collection of objects, unlike sequence objects such as lists and tuples, in which each element is indexed. Sets cannot have duplicate members - a given object appears in a set 0 or 1 times. All members of a set have to be hashable, just like dictionary keys. Integers, floating point numbers, tuples, and strings are hashable; dictionaries, lists, and other sets (except frozensets) are not.
 
Ligne 272 :
* [https://docs.python.org/2/library/stdtypes.html#set-types-set-frozenset Python Library Reference on Set Types] -- python.org
* [https://www.python.org/dev/peps/pep-0218/ PEP 218 -- Adding a Built-In Set Object Type], python.org, a nice concise overview of the set type
 
{{à traduire}}