Skip to content

Commit f990781

Browse files
committed
Lookup kwargs['f'] just once
1 parent 09ecbd1 commit f990781

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

galgebra/mv.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,16 +180,17 @@ def add_superscript(root, s):
180180
grade = __grade
181181
if utils.isstr(__name_or_coeffs):
182182
name = __name_or_coeffs
183-
if isinstance(kwargs['f'], bool) and not kwargs['f']: #Is a constant mulitvector function
183+
f = kwargs['f']
184+
if isinstance(f, bool) and not f: #Is a constant mulitvector function
184185
return sum([Symbol(add_superscript(name, super_script), real=True) * base
185186
for (super_script, base) in zip(ga.blade_super_scripts[grade], ga.blades[grade])])
186187

187188
else:
188-
if isinstance(kwargs['f'], bool): #Is a multivector function of all coordinates
189+
if isinstance(f, bool): #Is a multivector function of all coordinates
189190
return sum([Function(add_superscript(name, super_script), real=True)(*ga.coords) * base
190191
for (super_script, base) in zip(ga.blade_super_scripts[grade], ga.blades[grade])])
191-
else: #Is a multivector function of tuple kwargs['f'] variables
192-
return sum([Function(add_superscript(name, super_script), real=True)(*kwargs['f']) * base
192+
else: #Is a multivector function of tuple f variables
193+
return sum([Function(add_superscript(name, super_script), real=True)(*f) * base
193194
for (super_script, base) in zip(ga.blade_super_scripts[grade], ga.blades[grade])])
194195
elif isinstance(__name_or_coeffs, (list, tuple)):
195196
coeffs = __name_or_coeffs

0 commit comments

Comments
 (0)