On Thu, Apr 14, 2016 at 5:30 AM, Brett Cannon <br...@python.org> wrote: > > > On Wed, 13 Apr 2016 at 12:25 Chris Angelico <ros...@gmail.com> wrote: >> >> On Thu, Apr 14, 2016 at 3:10 AM, Brett Cannon <br...@python.org> wrote: >> > https://gist.github.com/brettcannon/b3719f54715787d54a206bc011869aa1 has >> > the >> > four potential approaches implemented (although it doesn't follow the >> > "separate functions" approach some are proposing and instead goes with >> > the >> > allow_bytes approach I originally proposed). >> >> All of them have this construct: >> >> try: >> path = path.__fspath__() >> except AttributeError: >> pass >> >> Is that the intention, or should the exception catching be narrower? I >> know it's clunky to write it in Python, but AIUI it's less so in C: >> >> try: >> callme = path.__fspath__ >> except AttributeError: >> pass >> else: >> path = callme() > > > I'm assuming the C code will do what you're suggesting. My way is just > faster to write in 2 minutes of coding. :)
Cool cool. Just checking! You're already aware that my preference is for the first one, str-only. I don't think the second one has much value (a path-like object can only ever return a str, but a bytes can be passed through unchanged?), and the fourth strikes me as a bad idea (just allowing bytes any time). So my votes are +1, -0.5, +0, -1. ChrisA _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com