Can global variable be passed into Python function?
Marko Rauhamaa
marko at pacujo.net
Sun Mar 2 04:40:05 EST 2014
Marko Rauhamaa <marko at pacujo.net>:
> If I take the API documentation on its face value, [...]
> I *must* use "is" for os.POSIX_FAVD_*:
>
> if fsavd_flag is os.POSIX_FADV_RANDOM:
> ...
However, since a documentation flaw is more than likely, it is even more
prudent to avoid both "==" and "is" and create a set of shadow constants
in the application code:
if self.fsavd_flag is self.FAVD_RANDOM:
os.posix_fadvice(fd, offset, len, os.POSIX_FAVD_RANDOM):
Marko
More information about the Python-list
mailing list