Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81455
| Path | csiph.com!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Dan Sommers <dan@tombstonezero.net> |
| Newsgroups | comp.lang.python |
| Subject | Re: I have no class |
| Date | Mon, 24 Nov 2014 13:44:18 +0000 (UTC) |
| Organization | A noiseless patient Spider |
| Lines | 37 |
| Message-ID | <m4vcni$97h$1@dont-email.me> (permalink) |
| References | <mailman.16156.1416712474.18130.python-list@python.org> <l9l27alml8scm4dvf29m2vidcudhh6766o@4ax.com> <mailman.16157.1416714761.18130.python-list@python.org> <2qn27adjq412n9nff9kv5jh25d1ekkbncp@4ax.com> <mailman.16160.1416722412.18130.python-list@python.org> <kre37at1cg1m0k3vcav2ekgohfrs5rb465@4ax.com> <mailman.16185.1416755794.18130.python-list@python.org> <8d047ahkrb4uh4qpq1uk74tel4nfc4s8uv@4ax.com> <mailman.16192.1416759279.18130.python-list@python.org> <up347a14v7v65meph33k53kas3jkqgmoo5@4ax.com> <66b13454-3503-4111-bf8e-58ce79ef00aa@googlegroups.com> <5472b24c$0$12979$c3e8da3$5496439d@news.astraweb.com> <mailman.16224.1416805895.18130.python-list@python.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| Injection-Date | Mon, 24 Nov 2014 13:44:18 +0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="7afa85ad1f051434641aa58aa18198d3"; logging-data="9457"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+fBCtgygOVkNvIh4/xnEiZ7ZSd5+RZPq0=" |
| User-Agent | Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) |
| Cancel-Lock | sha1:ydJMVg0ArQEi3tB55/zN7BYs384= |
| Xref | csiph.com comp.lang.python:81455 |
Show key headers only | View raw
On Mon, 24 Nov 2014 16:11:32 +1100, Chris Angelico wrote: > On Mon, Nov 24, 2014 at 3:21 PM, Steven D'Aprano <steve@pearwood.info> wrote: >> On Sun, 23 Nov 2014 09:02:57 -0800, Rustom Mody wrote: >> >>> Python is a bit odd in the OO-world in that it prioritizes "Explicit is >>> better than implicit" over convenience. >>> >>> Notice that you use self.throw where in most other OOP languages you >>> would use just throw. >> >> I don't think that is correct. I think that most OOP languages are like >> Python, and use a special variable to reference the current instance: >> >> In some of these languages, the use of "this/self/me" is optional, but >> I'm not aware of *any* OOP language where there is no named reference to >> the current object at all. > > I believe his point is that Python, unlike every other language he can > think of, requires "self.x" instead of just "x". Every language needs > a way to say "current object", but not every language needs you to say > that for every member reference. C++, Pike, and Java let you > short-hand that. (They're all deriving from the same syntactic style > anyway.) JavaScript doesn't, I believe, although its variable scoping > rules are some of the most insane I've ever met, so there might be a > way to shortcut it. If your experience of OO is mainly from C++/Java > family languages, then yes, Python will seem odd. And then, at least in C++, you see coding standards that demand that member variables (aka instance variables aka attributes) be named in such a way that you can tell that they're member variables and not local variables (one common convenstion is that all member variables begin with "m_"). IMO, that's a concession that all that implicitness and convenience just causes confusion. In Python, the names of all instance attributes begin with "self." Dan
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
I have no class Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-11-22 21:47 -0500
Re: I have no class random832@fastmail.us - 2014-11-22 22:08 -0500
Re: I have no class Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-11-22 22:16 -0500
Re: I have no class Rustom Mody <rustompmody@gmail.com> - 2014-11-22 19:09 -0800
Re: I have no class Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-11-22 22:18 -0500
Re: I have no class Ned Batchelder <ned@nedbatchelder.com> - 2014-11-22 22:14 -0500
Re: I have no class Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-11-22 22:35 -0500
Re: I have no class Joel Goldstick <joel.goldstick@gmail.com> - 2014-11-22 22:52 -0500
Re: I have no class Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-11-22 23:15 -0500
Re: I have no class Chris Angelico <rosuav@gmail.com> - 2014-11-23 17:00 +1100
Re: I have no class Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-11-23 05:52 -0500
Re: I have no class Dave Angel <davea@davea.name> - 2014-11-23 10:16 -0500
Re: I have no class Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-11-23 10:54 -0500
Re: I have no class Dave Angel <davea@davea.name> - 2014-11-23 11:14 -0500
Re: I have no class Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-11-23 11:49 -0500
Re: I have no class Chris Angelico <rosuav@gmail.com> - 2014-11-24 03:59 +1100
Re: I have no class Rustom Mody <rustompmody@gmail.com> - 2014-11-23 09:02 -0800
Re: I have no class Steven D'Aprano <steve@pearwood.info> - 2014-11-24 04:21 +0000
Re: I have no class Dave Angel <davea@davea.name> - 2014-11-24 00:11 -0500
Re: I have no class Chris Angelico <rosuav@gmail.com> - 2014-11-24 16:11 +1100
Re: I have no class Dan Sommers <dan@tombstonezero.net> - 2014-11-24 13:44 +0000
Re: I have no class Chris Angelico <rosuav@gmail.com> - 2014-11-25 00:48 +1100
Re: I have no class Dave Angel <davea@davea.name> - 2014-11-24 00:20 -0500
Re: I have no class Chris Angelico <rosuav@gmail.com> - 2014-11-24 16:21 +1100
Re: I have no class Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-11-24 13:47 -0500
Re: I have no class Rustom Mody <rustompmody@gmail.com> - 2014-11-22 19:55 -0800
Re: I have no class Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-11-22 23:19 -0500
Re: I have no class Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-11-23 15:35 +0000
csiph-web