Skip to content
Snippets Groups Projects
Commit 4b1dc93b authored by Bob Lantz's avatar Bob Lantz
Browse files

Avoid modifying keyword parameter dictionary in customized()

parent f58f83c0
No related branches found
No related tags found
No related merge requests found
......@@ -395,8 +395,11 @@ def irange(start, end):
def custom( cls, **params ):
"Returns customized constructor for class cls."
# Note: we may wish to see if we can use functools.partial() here
# and in customConstructor
def customized( *args, **kwargs):
"Customized constructor"
kwargs = kwargs.copy()
kwargs.update( params )
return cls( *args, **kwargs )
customized.__name__ = 'custom(%s,%s)' % ( cls, params )
......@@ -432,6 +435,7 @@ def customConstructor( constructors, argStr ):
def customized( name, *args, **params ):
"Customized constructor, useful for Node, Link, and other classes"
params = params.copy()
params.update( kwargs )
if not newargs:
return constructor( name, *args, **params )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment