Trees | Indices | Help |
|
---|
|
1 ############################################################################### 2 # # 3 # Copyright (C) 2013 Edward d'Auvergne # 4 # # 5 # This file is part of the program relax (http://www.nmr-relax.com). # 6 # # 7 # This program is free software: you can redistribute it and/or modify # 8 # it under the terms of the GNU General Public License as published by # 9 # the Free Software Foundation, either version 3 of the License, or # 10 # (at your option) any later version. # 11 # # 12 # This program is distributed in the hope that it will be useful, # 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 # GNU General Public License for more details. # 16 # # 17 # You should have received a copy of the GNU General Public License # 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. # 19 # # 20 ############################################################################### 21 22 # Module docstring. 23 """Module for handling Python lists.""" 24 2527 """Count the number of unique instances in the given list. 28 29 @keyword values: The original list. 30 @type values: list 31 @return: The number of unique instances. 32 @rtype: int 33 """ 34 35 # Create a new list. 36 new_list = unique_elements(values=values) 37 38 # The number. 39 return len(new_list)40 4143 """Return a new list with duplicates removed. 44 45 @keyword values: The original list. 46 @type values: list 47 @return: The new list with duplicates removed. 48 @rtype: list 49 """ 50 51 # Create a new list. 52 new_list = [] 53 for i in values: 54 if i not in new_list: 55 new_list.append(i) 56 57 # Return the new list. 58 return new_list59
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Jun 8 10:45:28 2024 | http://epydoc.sourceforge.net |