On Wed, Aug 23, 2017 at 1:12 AM, Stephan Houben <[email protected]> wrote: > Op 2017-08-22, Ian Kelly schreef <[email protected]>: >> Careful! Python's dunder methods are reserved for use by Python. >> They're exposed so that we can override them. Calling them directly is >> generally considered bad style. And in this case specifically, it's >> not equivalent. > > Mmm, you are correct. That's kind of a deception, really. > > I have often done things like: > > generate_id = itertools.count().__next__ > > but I suppose that isn't OK either, then.
That one probably won't bite you, but that doesn't mean it's correct. General rule of thumb: Dunders are for defining, not for calling. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
