Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Marko Rauhamaa Newsgroups: comp.lang.python Subject: Re: 3 Suggestions to Make Python Easier For Children Date: Sat, 02 Aug 2014 21:33:46 +0300 Organization: A noiseless patient Spider Lines: 33 Message-ID: <87a97mn3lh.fsf@elektro.pacujo.net> References: <7ef67ccc-3fc3-47dd-b858-09ef3b57a497@googlegroups.com> <87r40zmkhr.fsf@elektro.pacujo.net> <87mwbnmi7a.fsf@elektro.pacujo.net> <53dd0b30$0$29968$c3e8da3$5496439d@news.astraweb.com> <87k36qzuor.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx05.eternal-september.org; posting-host="ff5cf27ef3d5b31f034d3b72bdc27a41"; logging-data="17774"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/qoBXZ+CsDK0Q3Q/nYXEgO" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Cancel-Lock: sha1:cS/SMEh/0vbKjvcWsLnHv4+HSFc= sha1:P206P2P5qQCJ2hf1llf76fe8f7U= Xref: csiph.com comp.lang.python:75544 Mark Lawrence : > On 02/08/2014 18:07, Marko Rauhamaa wrote: >> And the newest Python releases let you replace that with: >> >> import types >> Object = types.SimpleNamespace > > With the latter being part of suggestion #3 in the original post. Not quite. Even though Sugg. #3 would allow me to do: object(x=3) this wouldn't work: object().x = 3 However, these would continue working: types.SimpleNamespace(x=3) types.SimpleNamespace().x = 3 Also, assuming Sugg. #3, would this work: object(x=3).y = 2 as this does: types.SimpleNamespace(x=3).y = 2 Marko