On 02/08/2014 22:05, Chris Angelico wrote:
On Sun, Aug 3, 2014 at 6:46 AM, Mark Summerfield <l...@qtrac.plus.com> wrote:
But perhaps what I should be asking for is for a new built-in that does what
types.SimpleNamespace() does, so that without any import you can write, say,
foo = namespace(a=1, b=2)
# or
bar = namespace()
bar.a = 1
where under the hood namespace has the same behavior as types.SimpleNamespace().
Naturally, I understand that adding a new name is a big deal and may be too
much to ask for beginners.
This is where you might want to consider putting some imports into
site.py. That way, you can set up your own customized Python, without
waiting for changes to be approved for core (which they probably won't
- new builtins have a high requirement for necessity, not just "I
don't want to have to type import").
ChrisA
I'd forgotten all about site.py so went to the 3.4.1 docs and found
"Deprecated since version 3.4: Support for the “site-python” directory
will be removed in 3.5.".
Plan B? :)
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
--
https://mail.python.org/mailman/listinfo/python-list