Victor Stinner wrote: > Hi, > > Python 3.3 introduced os.supports_dir_fd to check if some os functions > do accept a file descriptor instead of a path. The problem is that > os.supports_dir_fd is a list of functions, not a list of function > names. If os functions are monkey patched, you cannot test anymore if > a function supports file descriptor. One of the dangers of monkey-patching. > Monkey patching is a common practice in Python. test_os.py replaces > os.exec*() functions temporary for example. Perhaps for testing, but I don't think monkey-patching is common in production code. Perhaps you are thinking of Ruby :) > It's also inconsistent with the new time.get_clock_info() function > which expects the name of a time function, not the function directly. Since functions are first-class objects in Python, and people should be used to passing functions around as parameters, perhaps it is better to say that get_clock_info is inconsistent with supports_dir_fd. Personally, I prefer passing function objects rather than names, since the *name* of the function shouldn't matter. But since I recognise that other people may think differently, I would probably support passing both the name or the function object itself. -- Steven
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