Re: Autoloader (was Re: CSV Error)

2014-12-28 Thread Chris Angelico
On Mon, Dec 29, 2014 at 3:14 AM, Mark Lawrence wrote: >> Is anyone else interested in the patch? Should I create a tracker >> issue and upload it? > > I'd raise a tracker issue so it's easier to find in the future. http://bugs.python.org/issue23126 ChrisA -- https://mail.python.org/mailman/list

Re: Autoloader (was Re: CSV Error)

2014-12-28 Thread Mark Lawrence
On 28/12/2014 15:38, Chris Angelico wrote: On Mon, Dec 29, 2014 at 1:22 AM, Chris Angelico wrote: I wonder how hard it would be to tinker at the C level and add a __getattr__ style of hook... You know what, it's not that hard. It looks largeish as there are four places where NameError (not co

Re: Autoloader (was Re: CSV Error)

2014-12-28 Thread Chris Angelico
On Mon, Dec 29, 2014 at 2:38 AM, Chris Angelico wrote: > It's just like __getattr__: if it returns something, it's as > if the name pointed to that thing, otherwise it raises NameError. To clarify: The C-level patch has nothing about imports. What it does is add a hook at the point where NameErro

Re: Autoloader (was Re: CSV Error)

2014-12-28 Thread Chris Angelico
On Mon, Dec 29, 2014 at 1:22 AM, Chris Angelico wrote: > I wonder how hard it would be to tinker at the C level and add a > __getattr__ style of hook... You know what, it's not that hard. It looks largeish as there are four places where NameError (not counting UnboundLocalError, which I'm not tou

Re: Autoloader (was Re: CSV Error)

2014-12-28 Thread Chris Angelico
On Mon, Dec 29, 2014 at 1:15 AM, Skip Montanaro wrote: >> We were discussing something along these lines a while ago, and I >> never saw anything truly satisfactory - there's no easy way to handle >> a missing name by returning a value (comparably to __getattr__), you >> have to catch it and then

Re: Autoloader (was Re: CSV Error)

2014-12-28 Thread Skip Montanaro
> We were discussing something along these lines a while ago, and I > never saw anything truly satisfactory - there's no easy way to handle > a missing name by returning a value (comparably to __getattr__), you > have to catch it and then try to re-execute the failing code, which > isn't perfect. H

Autoloader (was Re: CSV Error)

2014-12-28 Thread Chris Angelico
On Mon, Dec 29, 2014 at 12:58 AM, Skip Montanaro wrote: > (Ignore the "autoloading" message. I use an autoloader in interactive > mode which comes in handy when I forget to import a module, as I did > here.) We were discussing something along these lines a while ago, and I never saw anything trul