<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Fri, 13 May 2016 at 16:14 Koos Zevenhoven <<a href="mailto:k7hoven@gmail.com">k7hoven@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Sat, May 14, 2016 at 2:05 AM, Brett Cannon <<a href="mailto:brett@python.org" target="_blank">brett@python.org</a>> wrote:<br>
><br>
><br>
> On Fri, 13 May 2016 at 15:09 Koos Zevenhoven <<a href="mailto:k7hoven@gmail.com" target="_blank">k7hoven@gmail.com</a>> wrote:<br>
>><br>
>> On Fri, May 13, 2016 at 11:50 PM, Ethan Furman <<a href="mailto:ethan@stoneleaf.us" target="_blank">ethan@stoneleaf.us</a>> wrote:<br>
>> > On 05/13/2016 01:30 PM, Koos Zevenhoven wrote:<br>
>> ><br>
>> >> It turns out it has been almost a month since this, and the PEP draft<br>
>> >> is already looking good. It seems we might now be ready to discuss it.<br>
>> >> Should we add the generic type FSPath[str]?<br>
>> ><br>
>> ><br>
>> > Guido's post on one of the other threads:<br>
>> > ----------------------------------------<br>
>> >> There's no need for typing.PathLike.<br>
>> ><br>
>> > So I'm gonna say no.  ;)<br>
>> ><br>
>><br>
>> Oh, it looks like a read those two emails in the wrong order ;).<br>
>><br>
>> Anyway, I was going to suggest making the abstract base class<br>
>> subscriptable too like this: PathABC[str] is a str-based path ABC, and<br>
>> PathABC[bytes] a bytes-based one ;). I don't know if that should be<br>
>> called a generic type or not, though.<br>
><br>
><br>
> The PEP already addresses this and says "no".<br>
<br>
I obviously know the PEP very well, and it doesn't. But I'm probably<br>
just doing a bad job explaining what I mean right now, and should<br>
probably go to bed. Sorry.<br></blockquote><div><br></div><div>Ah, I now see what you're proposing: somehow making the ABC a generic like the generics types in the typing module are (which would be a new feature for ABCs and why I didn't realize what you were initially asking for; sorry about that). The answer is still "no". :)</div><div><br></div><div>The generics support from the typing module is specific to that module and not applicable to ABCs themselves. Think of ABCs as helping guarantee that you implement specific methods and attributes. If your typing needs are met simply by that level of type information, then ABCs are fine as a type hint. But if you need something more specific like generics support then that's when it goes into the typing module (IOW don't think of the types in the typing module as ABCs or vice-versa but as separate things both dealing with duck-typing for their own purposes). Since the PEP already ruled out adding generics support for a special type representing os.PathLike or path-like objects, that also means it shouldn't be pushed into the ABC as an end-run around not going into the typing module.</div></div></div>