Open
Description
Line 41 in b2a3c9b
>>> class C(object):
... def __init__(self, ctx=None, *args, **kwargs):
... print(ctx, kwargs, kwargs.get('ctx'))
...
>>> try:
... c1 = C('this', ctx='that')
... except TypeError as err:
... print(err)
...
__init__() got multiple values for argument 'ctx'
>>> try:
... c2 = C(ctx='this', **{'ctx': 'that'})
... except TypeError as err:
... print(err)
...
type object got multiple values for keyword argument 'ctx'
>>> c3 = C('this', _ctx='that')
this {'_ctx': 'that'} None
>>> c4 = C(ctx='this is not in kwargs')
this is not in kwargs {} None
>>> c5 = C(**{'ctx': 'neither is this'})
neither is this {} None
Metadata
Metadata
Assignees
Labels
No labels
Activity