Viewing profile — Peristarkawan
Peristarkawan
HN member- Joined
- Thu, May 26, 2011, 5:49 PM UTC
- HN karma
- 24
- Public activity
- 12 items
- HN profile
- View on Hacker News ↗
About Peristarkawan
No profile information was provided.
Recent public activity
-
comment
Comment #2592191
I apologize. It was late, and my supply of patience for the day was exhausted.
-
comment
Comment #2590603
Sigh. No, that is not at all how super works in Python. The equivalent code to that Go function would be: def read_and_write(self): Reader.read(self) Writer.write(self) That is, if…
-
comment
Comment #2590566
I mistyped. I meant "subclass OrderedCounter to add in the __missing__ method".
-
comment
Comment #2590564
Not really. The only thing that changed about super in Python 3 is that you can call it with no arguments, which is just a short-hand for the way it was already used in Python 2. E…
-
comment
Comment #2589704
The version that I was rewriting: def __init__(self, shapename=None, **kwds): also allows that.
-
comment
Comment #2589389
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 requir…
-
comment
Comment #2589012
That's entirely the caller's fault, not the function's. Compare: >>> def init(**kwargs): ... pass ... >>> init(shapename='circle', **{'shapename': 'circle'}) Traceback (most recent…
-
comment
Comment #2588908
I disagree, that's extremely fragile. It might work for the particular class you are implementing. However, it might cause subclasses of that class to break, since those subclasses…
-
comment
Comment #2588890
The reason for using keywords is that there is no guarantee that the next class in the MRO after ColoredShape will be Shape. When the instance is a ColoredShape, it will be, but if…
-
comment
Comment #2588785
Okay, I give. What's the markup for posting code snippets on this site?
-
comment
Comment #2588756
It seems to me that the example of combining built-in dictionary classes is naively optimistic. For starters, OrderedDict, as it happens, does not use super! It calls the dict supe…
-
comment
Comment #2588710
Yes, Python's super is more like Dylan's next-method than, say, C#'s super.