Can global variable be passed into Python function?
marko at pacujo.net
Sun Mar 2 11:37:13 CET 2014
Chris Angelico <rosuav at gmail.com>:
> And there's another thing you can do to test.
>>>> import os
> <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:
More information about the Python-list