Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Marko Rauhamaa Newsgroups: comp.lang.python Subject: Re: Ah Python, you have spoiled me for all other languages Date: Fri, 22 May 2015 23:34:47 +0300 Organization: A noiseless patient Spider Lines: 27 Message-ID: <87k2w0mjvc.fsf@elektro.pacujo.net> References: <555f440a$0$12990$c3e8da3$5496439d@news.astraweb.com> <201505221914.t4MJE3e9009120@fido.openend.se> <555F84CD.9010204@mrabarnett.plus.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="b7cb1518d23ec19d482dcc9c31d30fdd"; logging-data="17652"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19BsqConF5439eCl7+9COVN" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:rZYt5/1hgKfrqE9BOd32QV575Dc= sha1:S2GTCqNgn70yN3A8LPbF1RxXiXk= Xref: csiph.com comp.lang.python:91072 Ian Kelly : > An "object" in Javascript is basically just a collection of > properties. For example: > > js> typeof([1, 2, 3]) > "object" > js> typeof({a: 1, b: 2, c: 3}) > "object" > > Here's what happens when you try to access a property on null: > > js> null.foo > typein:18:0 TypeError: null has no properties That's not all that different from Python, where object() returns a fresh instance at each invocation. However: >>> object().x = 3 Traceback (most recent call last): File "", line 1, in AttributeError: 'object' object has no attribute 'x' Why are object instances immutable in Python? Marko