Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'say,': 0.05; 'subject:Python': 0.06; 'namespace': 0.09; 'cc:addr:python- list': 0.11; 'changes': 0.15; 'b=2)': 0.16; 'builtins': 0.16; 'does,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'imports': 0.16; 'subject:object': 0.16; 'subject:simple': 0.16; 'subject:type': 0.16; 'write,': 0.16; 'wrote:': 0.18; 'import': 0.22; 'aug': 0.22; 'putting': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'asking': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message- id:@mail.gmail.com': 0.30; '(which': 0.31; 'probably': 0.32; 'core': 0.34; 'requirement': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'should': 0.36; 'too': 0.37; 'does': 0.39; 'subject:" ': 0.39; 'customized': 0.61; 'new': 0.61; 'name': 0.63; 'high': 0.63; 'skip:n 10': 0.64; 'approved': 0.65; 'behavior': 0.77; 'subject:For': 0.78; 'hood': 0.84; 'subject:Make': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=HkE9lpL8xbV3QK/i90FHNzgycKLTlfdj4rMiuCkfXX4=; b=jGu2HW17MNPs58eRpd1gf4LISRHY847vzXOwRHTfUGiZq8BbTanu/C57DLBECnfMQA 5TCIsTt+F/gG8WgALGBcHWQAU+sjphQakZlrDqobO6vJqeHyGyA1QT9Wjsdgr5B9+fMN /n28yfGWS2ihjGjuVqRX3igFIwzTO5kB3zliOjpVuNuY+7vRS9GuxC1gINX2ur0boNJ3 /rkW3oIWYQ7KsqpDmURJ2DrpYYHfAol7X4698pTbnxVoldCxGHJi6v6bRNNXZWCy+GHn uP8/r+pr0KPk1FVijueP1y5i4pDYa2L7i2KT+t3FtW0BCvJwR8D9Gb1OBB/qs6NHFb6e mOnw== MIME-Version: 1.0 X-Received: by 10.50.80.76 with SMTP id p12mr21518167igx.34.1407013539266; Sat, 02 Aug 2014 14:05:39 -0700 (PDT) In-Reply-To: <70e5f2f1-661f-40f2-bb7a-76e569c4d092@googlegroups.com> References: <7ef67ccc-3fc3-47dd-b858-09ef3b57a497@googlegroups.com> <87r40zmkhr.fsf@elektro.pacujo.net> <53dd0717$0$29973$c3e8da3$5496439d@news.astraweb.com> <70e5f2f1-661f-40f2-bb7a-76e569c4d092@googlegroups.com> Date: Sun, 3 Aug 2014 07:05:39 +1000 Subject: Re: Correct type for a simple "bag of attributes" namespace object (was: 3 Suggestions to Make Python Easier For Children) From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1407013547 news.xs4all.nl 2962 [2001:888:2000:d::a6]:52497 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:75547 On Sun, Aug 3, 2014 at 6:46 AM, Mark Summerfield 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