Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #99723
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!newsfeed0.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Nagy László Zsolt <gandalf@shopzeus.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: variable vs. object |
| Date | Mon, 30 Nov 2015 09:09:32 +0100 |
| Lines | 28 |
| Message-ID | <mailman.21.1448870980.14615.python-list@python.org> (permalink) |
| References | <2b4696d5-c9fb-4ca6-92a3-564e47712d59@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252 |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | news.uni-berlin.de hHSPccLDeFc3G34IR8tgDg+5DN0ZHyrTjpIr6LehRXHw== |
| Return-Path | <gandalf@shopzeus.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; "'a'": 0.07; '"a"': 0.09; 'objects.': 0.09; 'python:': 0.09; 'example:': 0.10; 'languages.': 0.15; 'variables': 0.15; '"create': 0.16; '"set': 0.16; 'distinction': 0.16; 'integer.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'stored.': 0.16; 'subject:object': 0.16; 'subject:variable': 0.16; 'too?': 0.16; 'memory': 0.17; 'integer': 0.18; 'refers': 0.18; 'variable': 0.18; 'object.': 0.22; 'header:In-Reply-To:1': 0.24; 'contrast,': 0.29; 'objects': 0.29; 'certain': 0.31; 'point': 0.33; 'values.': 0.33; 'level': 0.35; 'but': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'names': 0.38; 'to:addr:python.org': 0.40; 'where': 0.40; 'charset:windows-1252': 0.62; 'different': 0.63; 'strictly': 0.64; 'between': 0.65; 'subject:. ': 0.67; 'low': 0.83 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=shopzeus.com; s=shopzeus_com; t=1448870973; bh=sZ2hH/r4OcEfwjHpvQcE2WGrCKpJLmaJhiFGyQZFEwA=; h=Subject:To:References:From:Date:In-Reply-To:From; b=E3clIGoR3/XANqJo7vFYHun/3pPyFPB0Nc+NMw5jSZCBlOHHoZZmDSKhodb6scA8Q m+bSS8ASUpHb9nybYUEEN73d4F1hmJPzqJ0SHVF/TxM2rzKVptGyAUZTdrvuV2Db3F QQW3weYLEliQ/NEX2fWgW6YPxpB8apfRbgJMCc6CxDfFoupOzgwpt/LOtJZIiR+lvh A9aUinEpqSOSCPxh0WOT8YgvJsDxD9ykA10ydH6RjH+R2TAKp0X+wAFRq/4Hyev+5o YIrdTQvOKoAh25LdsHkGEJr+PPvnH7BORMZUxtzUhvT5KpD2TEexyWGOmtWP/ygZdB Lj3HwDgFoic3w== |
| In-Reply-To | <2b4696d5-c9fb-4ca6-92a3-564e47712d59@googlegroups.com> |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.20+ |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:99723 |
Show key headers only | View raw
> a=10 > > 'a' is an integer. Is it an object too? In Python, objects have an identity. When you do "a=10" then you *bind* the object to the name *a*. By "variable", the documentation refers to a name that was bound to an object. This is different from many other low level languages. For example: in C, you can do a=10; And it will "set the value of the variable 'a' to 10". In other words: "a" is not just a name, it refers to a certain location in memory where an integer value is stored. And in C, it is not an object but a value of a built-in type. In contrast, this is what happens in Python: * An "Integer" object is constructed with the value 10. * This object is then bound to the name "a". The key point is that "variables" are just names that may reference to objects. There is a distinction between names and objects. Strictly speaking, you cannot "set the value of a variable", because variables do not hold values. They just refer to objects. In Python, you can only "create an object", or "change the state of an object", and "bind a name to an object".
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
variable vs. object fl <rxjwg98@gmail.com> - 2015-11-29 18:06 -0800
Re: variable vs. object Joel Goldstick <joel.goldstick@gmail.com> - 2015-11-29 21:16 -0500
Re: variable vs. object André Roberge <andre.roberge@gmail.com> - 2015-11-29 18:24 -0800
Re: variable vs. object Ben Finney <ben+python@benfinney.id.au> - 2015-11-30 13:45 +1100
Re: variable vs. object Ben Finney <ben+python@benfinney.id.au> - 2015-11-30 13:41 +1100
Re: variable vs. object Marko Rauhamaa <marko@pacujo.net> - 2015-11-30 07:28 +0200
Re: variable vs. object Nagy László Zsolt <gandalf@shopzeus.com> - 2015-11-30 09:09 +0100
Re: variable vs. object Chris Angelico <rosuav@gmail.com> - 2015-11-30 19:19 +1100
csiph-web