Chris Angelico <ros...@gmail.com>:

> And there's another thing you can do to test.
>
>>>> import os
>>>> type(os.POSIX_FADV_RANDOM)
> <class 'int'>

Is that what you do in your programs?

> So use ==. If it's later changed and you have to instead use 'is', you
> can change your code.

Quite a robust API, huh?

Anyway, you recognize that the API definer is within their rights to
require 'is' semantics for the constants. IOW, the application must use
the given constant objects and nothing that happens to be == to them.

Consequently, the implementer is within their rights to define:

   def __eq__():
       return True


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to