On Wed, 5 May 2021 at 11:33, Matt del Valle <matthew...@gmail.com> wrote:
>> To give an example: >> >> def spam(): >> return "spam spam spam!" >> >> def eggs(): >> return spam() >> >> namespace Shop: >> def spam(): >> return "There's not much call for spam here." >> def eggs(): >> return spam() >> >> print(eggs()) >> # should print "spam spam spam!" >> print(Shop.eggs()) >> # should print "There's not much call for spam here." > > > I'm guessing this was a typo and you meant to type: > > print(spam()) > # should print "spam spam spam!" > print(Shop.spam()) > # should print "There's not much call for spam here." > > Because if you did, then this is precisely how it would work under this > proposal. :) I'm not the OP, but I read their question precisely as it was written. The global eggs() returns the value from calling spam() and should use the *global* spam. The eggs in namespace Shop calls spam and returns its value, and I'd expect that call to resolve to Shop.spam, using the namespace eggs is defined in. If that's not how you imagine namespaces working, I think they are going to be quite non-intuitive for at least a certain set of users (including me...) Paul _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/SCBZDQQT3A3OISOTSOB7WSQNI5HFHSBL/ Code of Conduct: http://python.org/psf/codeofconduct/