@@ -85,6 +85,12 @@ You can use the `asdict` method to return ISO 639 values as a Python dictionary
8585{' name' : ' French' , ' pt1' : ' fr' , ' pt2b' : ' fre' , ' pt2t' : ' fra' , ' pt3' : ' fra' , ' pt5' : ' ' }
8686```
8787
88+ Lists of ` Lang ` instances are sortable by name.
89+ ``` python
90+ >> > [lg.name for lg in sorted ([Lang(" deu" ), Lang(" rus" ), Lang(" eng" )])]
91+ [' English' , ' German' , ' Russian' ]
92+ ```
93+
8894### Other Language Names
8995
9096In addition to their reference name, some language identifiers may be associated with other names. You can list them using the ` other_names ` method.
@@ -96,7 +102,7 @@ In addition to their reference name, some language identifiers may be associated
96102[' Asturleonese' , ' Bable' , ' Leonese' ]
97103```
98104
99- ### Language Types
105+ ### Language Type
100106
101107The type of a language is accessible thanks to the ` type ` method.
102108``` python
@@ -105,7 +111,7 @@ The type of a language is accessible thanks to the `type` method.
105111' Historical'
106112```
107113
108- ### Macrolanguages
114+ ### Macrolanguage & Individual Languages
109115
110116You can easily determine whether a language is a macrolanguage or an individual language.
111117``` python
@@ -129,30 +135,6 @@ Conversely, you can also list all the individual languages that share a common m
129135Lang(name = ' Dari' , pt1 = ' ' , pt2b = ' ' , pt2t = ' ' , pt3 = ' prs' , pt5 = ' ' )]
130136```
131137
132- ### In Data Structures
133-
134- As ` Lang ` is hashable, ` Lang ` instances can be added to a set or used as dictionary keys.
135- ``` python
136- >> > {Lang(" de" ): " foo" , Lang(" fr" ): " bar" }
137- {Lang(name = ' German' , pt1 = ' de' , pt2b = ' ger' , pt2t = ' deu' , pt3 = ' deu' , pt5 = ' ' ): ' foo' , Lang(name = ' French' , pt1 = ' fr' , pt2b = ' fre' , pt2t = ' fra' , pt3 = ' fra' , pt5 = ' ' ): ' bar' }
138- ```
139-
140- Lists of ` Lang ` instances are sortable by name.
141- ``` python
142- >> > [lg.name for lg in sorted ([Lang(" deu" ), Lang(" rus" ), Lang(" eng" )])]
143- [' English' , ' German' , ' Russian' ]
144- ```
145-
146- ### Iterator
147-
148- ` iter_langs() ` iterates through all possible ` Lang ` instances, ordered alphabetically by name.
149-
150- ``` python
151- >> > from iso639 import iter_langs
152- >> > [lg.name for lg in iter_langs()]
153- [" 'Are'are" , " 'Auhelawa" , " A'ou" , ... , ' ǂHua' , ' ǂUngkue' , ' ǃXóõ' ]
154- ```
155-
156138### Exceptions
157139
158140When an invalid language value is passed to ` Lang ` , an ` InvalidLanguageValue ` exception is raised.
@@ -200,9 +182,20 @@ False
200182True
201183```
202184
185+ ### Iterator
186+
187+ ` iter_langs() ` iterates through all possible ` Lang ` instances, ordered alphabetically by name.
188+
189+ ``` python
190+ >> > from iso639 import iter_langs
191+ >> > [lg.name for lg in iter_langs()]
192+ [" 'Are'are" , " 'Auhelawa" , " A'ou" , ... , ' ǂHua' , ' ǂUngkue' , ' ǃXóõ' ]
193+ ```
194+
195+
203196## Speed
204197
205- ` iso639-lang ` loads its mappings into memory to process calls much [ faster] ( https://github.com/LBeaudoux/benchmark-iso639 ) than Python libraries that rely on an embedded database.
198+ ` iso639-lang ` loads its mappings into memory to process calls much faster than Python libraries that rely on an embedded database.
206199
207200
208201## Sources
0 commit comments