Live data from Hacker News

Viewing profile — Peristarkawan

Peristarkawan

HN member
Joined
Thu, May 26, 2011, 5:49 PM UTC
HN karma
24
Public activity
12 items

About Peristarkawan

No profile information was provided.

Recent public activity

  1. comment
    Comment #2592191

    I apologize. It was late, and my supply of patience for the day was exhausted.

  2. 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…

  3. comment
    Comment #2590566

    I mistyped. I meant "subclass OrderedCounter to add in the __missing__ method".

  4. 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…

  5. comment
    Comment #2589704

    The version that I was rewriting: def __init__(self, shapename=None, **kwds): also allows that.

  6. 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…

  7. 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…

  8. 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…

  9. 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…

  10. comment
    Comment #2588785

    Okay, I give. What's the markup for posting code snippets on this site?

  11. 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…

  12. comment
    Comment #2588710

    Yes, Python's super is more like Dylan's next-method than, say, C#'s super.