Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #42293
| References | <78680654-5cf5-435c-9fce-19d6f5c23360@googlegroups.com> <mailman.3965.1364592243.2939.python-list@python.org> <51561ae3$0$29974$c3e8da3$5496439d@news.astraweb.com> |
|---|---|
| Date | 2013-03-30 09:59 +1100 |
| Subject | Re: Python class and variable issue(newby question!) |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3974.1364597970.2939.python-list@python.org> (permalink) |
On Sat, Mar 30, 2013 at 9:51 AM, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > On Sat, 30 Mar 2013 08:24:00 +1100, Chris Angelico wrote: > >> On Sat, Mar 30, 2013 at 8:12 AM, Sam Berry <sambez_14@hotmail.co.uk> >> wrote: >>> class test() >>> s = 1 >>> >>> def test1() >>> global s >>> s = 2 > >> That's not a global, that's a class variable. > > > /me thwacks Chris with a halibut. Ow ow ow, I give in... I am suitably and appropriately thwacked. > Not only is "class variable" ambiguous, but Python uses different scoping > rules for "variables" (name bindings) and attributes. Yes, I should have said class ATTRIBUTE. Sorry all! (Can I blame the whole 8AM and still up thing? No? Mea culpa, anyhow.) > I don't know what language first decided to conflate object attributes > and variables -- I suspect Java -- but it is actively harmful terminology > (in Python at least, if not in general) and whoever invented it is bad > and should feel bad. Agreed. Unfortunately it permeates a lot of programmer's vocabularies, mine included. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Python class and variable issue(newby question!) Sam Berry <sambez_14@hotmail.co.uk> - 2013-03-29 14:12 -0700
Re: Python class and variable issue(newby question!) Chris Angelico <rosuav@gmail.com> - 2013-03-30 08:24 +1100
Re: Python class and variable issue(newby question!) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-29 22:51 +0000
Re: Python class and variable issue(newby question!) Chris Angelico <rosuav@gmail.com> - 2013-03-30 09:59 +1100
Re: Python class and variable issue(newby question!) Benjamin Kaplan <benjamin.kaplan@case.edu> - 2013-03-29 14:23 -0700
Re: Python class and variable issue(newby question!) Sam Berry <sambez_14@hotmail.co.uk> - 2013-03-29 15:17 -0700
Re: Python class and variable issue(newby question!) Chris Angelico <rosuav@gmail.com> - 2013-03-30 09:45 +1100
Re: Python class and variable issue(newby question!) Dave Angel <davea@davea.name> - 2013-03-29 18:56 -0400
csiph-web