[Python-Dev] PEP 420 - dynamic path computation is missing rationale
Eric V. Smith
eric at trueblade.com
Wed May 23 15:10:42 CEST 2012
On 05/23/2012 09:02 AM, Nick Coghlan wrote:
> On Wed, May 23, 2012 at 10:31 PM, Eric V. Smith <eric at trueblade.com> wrote:
>> On 05/22/2012 09:49 PM, PJ Eby wrote:
>>> It shouldn't - all you should need is to use
>>> getattr(sys.modules[self.modname], self.attr) instead of referencing a
>>> parent path object directly.
>>
>> The problem isn't the lookup, it's coming up with self.modname and
>> self.attr. As it currently stands, PathFinder.find_module is given the
>> parent path, not the module name and attribute name used to look up the
>> parent path using sys.modules and getattr.
>
> Right, that's what PJE and I were discussing. Instead of passing in
> the path object directly, you can instead pass an object that *lazily*
> retrieves the path object in its __iter__ method:
Hey, one message at a time! I'm just reading those now.
I'd like to hear Brett's comments on this approach.
Eric.
More information about the Python-Dev
mailing list