<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Mon, 7 May 2018 at 08:17 Serhiy Storchaka <<a href="mailto:storchaka@gmail.com">storchaka@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">07.05.18 17:42, Eric Snow пише:<br>
> I'm not necessarily saying we should add ModuleSpec.dirname(), but it<br>
> (or something like it) is what I'd advocate for *if* we were to add a<br>
> convenient shortcut to the directory a module is in.  FWIW, I'd<br>
> probably use it.<br>
<br>
The question is *why* you need the absolute path to the directory the <br>
module is in? Taking into account the availability of <br>
importlib.resources etc.<br></blockquote><div><br></div><div>And just "why", and "how often"? I'm sure we have all done it before, but it isn't something that comes up <i>constantly</i>. And duplicating part of the details what __spec__.location contains just to save an import and a line to strip off the file seems unnecessary. Plus, this doesn't take into consideration the fact that not every module is going to exist in a directory (e.g. what if I loaded from a sqlite database?).<br><br></div><div>IOW I'm -1 on this addition to modules as I don't think it's difficult enough or used enough to warrant adding the overhead of providing it.<br></div></div></div>