Guido van Rossum wrote:
> Actually, requiring isinstance(pos, int) is too rigid. You should use
> __index__() instead, which allows other int-like numbers but not float
> numbers.

I wasn't familiar with the __index__() method.

Is this fine with you?

    def seek(self, pos, whence=0):
        if not hasattr(pos, "__index__"):
            raise TypeError("an integer is required")
        pos = pos.__index__()
        if whence == 0:
            ...

I want it to raise a TypeError to keep it consistent with _fileio's seek.

Christian
_______________________________________________
Python-3000-checkins mailing list
Python-3000-checkins@python.org
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to