A desperate lunge for on-topic-ness

Joshua Landau joshua.landau.ws at gmail.com
Tue Oct 23 03:35:56 EDT 2012


On 23/10/2012, Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
> On Mon, 22 Oct 2012 16:02:34 -0600, Ian Kelly <ian.g.kelly at gmail.com>
> declaimed the following in gmane.comp.python.general:
>
>> On my wishlist for Python is a big, fat SyntaxError for any variable
>> that could be interpreted as either local or nonlocal and is not
>> explicitly declared as either.  It would eliminate this sort of
>> confusion entirely and make code that shadows nonlocal variables much
>> more readable.
>>
> 	Which now makes code dependent upon changes to some imported modules
> if someone is foolish enough to use the
>
> 	from xyz import *
>
> notation...
>
> 	I'd be very displeased if working code with local names suddenly
> fails because some third-party package was updated.
>
> 	Yes, I prefer not to use the "from...*" notation, but how many
> tutorials (especially of GUI toolkits, with their dozens of constants)
> illustrate using the wildcard?

I'm not particularly fond (or disliking) of the proposal, but we
already make changes to the structure of locals/globals and so forth
when someone does "from <something> import *". Disabling checks when
it is used is totally reasonable.

Additionally, "SyntaxError: import * only allowed at module level".
This means, as far as I grasp, one should never *manage* to create an
ambiguity here. Ian already stated this idea should (due to
neccessity) be disabled for possible globals.



More information about the Python-list mailing list