Aug-05-2021, 06:05 PM
Aug-05-2021, 07:40 PM
#!/usr/bin/env python3 # -*-coding: utf8-*- # pyman -- program to browse python documentation. import argparse import webbrowser __version__ = '2019.11.8' def main(word, version): assert version in (2, 3) url = "https://docs.python.org/{}/search.html".format( version) + ('?q=' + word if word else '') webbrowser.open(url) if __name__ == '__main__': parser = argparse.ArgumentParser(description="Search python documentation") parser.add_argument('-v', '--version', dest='version', type=int, help='Python version 2 or 3. Defaults to 3.', default=3) parser.add_argument('word', metavar='WORD', help='The word to search', default='', nargs='?') ns = parser.parse_args() main(ns.word, ns.version)
Aug-05-2021, 09:59 PM
i don't see the point in keeping these compatible names. eventually, everyone should just stop using them and just use OSError. there be a compatibility phase-out period, of course. when might that be.
BTW, i no longer use IOError. OTOH, i was disappointed to see it be more than just I/O errors.
BTW, i no longer use IOError. OTOH, i was disappointed to see it be more than just I/O errors.
Aug-06-2021, 10:18 AM
https://docs.python.org/3/library/exceptions.html
It's not deprecated, it's merged. IOError still exists and you can catch it with an OSError.
Quote:Changed in version 3.3: EnvironmentError, IOError, WindowsError, socket.error, select.error and mmap.error have been merged into OSError, and the constructor may return a subclass.
It's not deprecated, it's merged. IOError still exists and you can catch it with an OSError.
print(IOError.mro())
Output:[<class 'OSError'>, <class 'Exception'>, <class 'BaseException'>, <class 'object'>]
Aug-06-2021, 06:05 PM
OSError is all you need. you don't need IOError any more. i am disappointed that the merger took place. i believe there could be a use case to differentiate these, though i have not run into one, yet. i believe i have in my C days (e.g. an error from an I/O syscall that errno indicated a system error like out of memory)