[issue45540] module.__package__ and module.__spec__.parent have different semantics

2021-10-21 Thread Brett Cannon
Brett Cannon added the comment: Sure, if you want to go full PEP on this I'm happy to be a co-author if the end goal is to ditch the (now) extraneous attributes. -- ___ Python tracker

[issue45540] module.__package__ and module.__spec__.parent have different semantics

2021-10-21 Thread Eric Snow
Eric Snow added the comment: On Thu, Oct 21, 2021 at 11:54 AM Barry A. Warsaw wrote: > Thanks for your comprehensive comments Eric! While I digest them, my TL;DR > is that we probably need a PEP to describe everything from the current > situation, to the the desired end state and migration

[issue45540] module.__package__ and module.__spec__.parent have different semantics

2021-10-21 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: Thanks for your comprehensive comments Eric! While I digest them, my TL;DR is that we probably need a PEP to describe everything from the current situation, to the the desired end state and migration path. I'm willing to put that together with you and

[issue45540] module.__package__ and module.__spec__.parent have different semantics

2021-10-21 Thread Eric Snow
Eric Snow added the comment: On Wed, Oct 20, 2021 at 6:11 PM Barry A. Warsaw wrote: > This is what leads me to think that having a proxy to keep them in sync and > relaxing the read-only restriction is the path forward, even if writing > __package__ doesn’t make sense. It also seems like

[issue45540] module.__package__ and module.__spec__.parent have different semantics

2021-10-21 Thread Eric Snow
Eric Snow added the comment: On Wed, Oct 20, 2021 at 6:11 PM Barry A. Warsaw wrote: > I guess a question to answer then is whether we philosophically want the > module attributes to be equivalent to the spec attributes. And by > equivalent, I mean enforced to be exactly so, and thus a

[issue45540] module.__package__ and module.__spec__.parent have different semantics

2021-10-20 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: On Oct 20, 2021, at 11:38, Eric Snow wrote: > > Regardless, I expect the primary reason __package__ is writable is > because modules have never had any read-only attrs. So historical accident mostly. > The more important question now is, when is

[issue45540] module.__package__ and module.__spec__.parent have different semantics

2021-10-20 Thread Eric Snow
Eric Snow added the comment: On Wed, Oct 20, 2021 at 11:11 AM Barry A. Warsaw wrote: > Maybe we should relax the restriction on module.__spec__.parent so that it's > writeable just like module.__package__. Hmm, I hadn't realized __package__ is used in __import__(). That makes things

[issue45540] module.__package__ and module.__spec__.parent have different semantics

2021-10-20 Thread Brett Cannon
Brett Cannon added the comment: I say make it writable. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45540] module.__package__ and module.__spec__.parent have different semantics

2021-10-20 Thread Barry A. Warsaw
Change by Barry A. Warsaw : -- nosy: +brett.cannon, eric.snow ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45540] module.__package__ and module.__spec__.parent have different semantics

2021-10-20 Thread Barry A. Warsaw
New submission from Barry A. Warsaw : TL;DR module.__spec__.parent is read-only but module.__package__ is r/w despite documentation that implies that these two attributes should be identical, and various issues that focus on migrating from direct module attributes to ModuleSpec attributes.