> > This proposal seems to be harking back to the meaning of 'with' in > earlier languages, e.g. Pascal, where it makes the fields of a > structure temporarily accessible without qualification. > > Before we got the current version of 'with' in Python, there were > periodic proposals to add a similar kind of 'with', but the > consensus was that it was better to just assign the object to a > short local name and qualify with that. As far as I can see, the > situation hasn't changed. >
I agree. This is why my preferred solution would be more something like I proposed, such as: def my_namespace: a = 1 def f(x): ... etc etc. I also do not see any benefit in being able to provide some arbitrary string as the module/namespace name, as others have proposed: with Namespace('ns') as ns: ... Modules are already named by the file name they reside in. Functions (also defined using "def") are named using the name given to the function. Same with a class. Creating a namespace/module type thing that receives its name as some argument would seem, to me, to be orthogonal to these other situations.
_______________________________________________ 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/2SRX5SHNBTBDH7RV4A35LHSTNN6KTQWL/ Code of Conduct: http://python.org/psf/codeofconduct/