Larry Hastings <la...@hastings.org> added the comment:

Thank you for your in-depth and thoughtful reply!

I think that APIs should behave in a predictable way.  So, for my use case, I 
tell the user that I'm passing "globals" and "locals" into eval()--and I think 
I'd have to have a *very* compelling reason to swap them.  Since I don't have 
the backwards-compatibility problem you do, I think I should keep it simple and 
predictable and not swap them.

In reference to your example, I think it's natural enough that the A defined 
inside B eclipses the module-level A.  That's what the user would *expect* to 
happen.  If the user really wants to reference the module-level A, they have 
lots of options:

  * rename one or the other A to something else
  * establish an alias at module scope, and use that
  * explicitly say globals()['A']

So I'm not worried about it.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42904>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to