Revision 4b1dc93b

View differences:

mininet/util.py
395 395

  
396 396
def custom( cls, **params ):
397 397
    "Returns customized constructor for class cls."
398
    # Note: we may wish to see if we can use functools.partial() here
399
    # and in customConstructor
398 400
    def customized( *args, **kwargs):
399 401
        "Customized constructor"
402
        kwargs = kwargs.copy()
400 403
        kwargs.update( params )
401 404
        return cls( *args, **kwargs )
402 405
    customized.__name__ = 'custom(%s,%s)' % ( cls, params )
......
432 435

  
433 436
    def customized( name, *args, **params ):
434 437
        "Customized constructor, useful for Node, Link, and other classes"
438
        params = params.copy()
435 439
        params.update( kwargs )
436 440
        if not newargs:
437 441
            return constructor( name, *args, **params )

Also available in: Unified diff