4 ms·
That's true. The second one might be better written as: def __init__(self, shapename, **kwds): Or, in Python 3: def __init__(self, *, shapename, **kwds)
by Peristarkawan 15y ago
That's true. The second one might be better written as:
def __init__(self, shapename, **kwds):
Or, in Python 3:
def __init__(self, *, shapename, **kwds):
(making shapename a required keyword-only argument)
- reinhardt 15y agodef __init__(self, shapename, **kwds): is not better written; it allows shapename to be passed positionally which makes cooperative inheritance fragile.
- Peristarkawan 15y agoThe version that I was rewriting: def __init__(self, shapename=None, **kwds): also allows that.