Skip to content

Commit 1c20805

Browse files
Added __len__ to VariablesDict
1 parent cb776b4 commit 1c20805

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cvxtorch/variables_dict/variables_dict.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ def __init__(self, provided_vars_list: list=[]):
66
self.vars_dict = dict()
77
for var in provided_vars_list:
88
self.add_var(var)
9-
9+
10+
def __len__(self) -> int:
11+
return len(self.vars_dict)
12+
1013
def add_var(self, var):
1114
"""
1215
var is expected to be either a cp.Variable or a cp.Parameter, but is not enforced.

0 commit comments

Comments
 (0)