Andrew Koenig wrote: > On the other hand, the library isn't nearly so consistent. Just for > fun, I started browsing the library documentation at random. > > The very first page I visited was the description of gc, the > garbage collector interface. The first function that returns > a truth value there is described as > > isenabled() > Returns true if automatic collection is enabled. >>> import gc >>> gc.isenabled() 1 >>> type(gc.isenabled()) <type 'int'> > endswith(suffix[,start[,end]]) > Return true if the string ends with the specified suffix, > otherwise return false. >>> "spam".endswith("m") 1 >>> type("spam".endswith("m")) <type 'int'> > isatty() > Return true if the file is connected to a tty(-like) device, > else false. >>> sys.stdout.isatty() 1 >>> type(sys.stdout.isatty()) <type 'int'> > exists(path) > Return true if path refers to an existing path. >>> os.path.exists("/etc/passwd") 1 >>> type(os.path.exists("/etc/passwd")) <type 'int'> looks pretty consistent to me ;-) (Python docs tend to use "true" to mean anything which isn't "false", and where operator.truth returns the right thing. this won't change post-PEP -- if you start interpreting "return true" as "return True", you'll be asking for trouble) </F>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4