l_user at yahoo.com
Thu Apr 27 23:31:26 CEST 2000
Andrew Cooke <andrew at andrewcooke.free-online.co.uk> wrote in message
news:8e937n$f4p$1 at nnrp1.deja.com...
> In article <3906542D.62B94F17 at darmstadt.gmd.de>,
> Robb Shecter <shecter at darmstadt.gmd.de> wrote:
> > Michael Hudson wrote:
> > Choice A: Have a smalltalk-like instance variable declaration.
> > to say that I like "Choice A". I come from Java, and it did bug me a
> > bit that there was no one easy place to see what instance variables a
> > class has. It made understanding the XML parser source code harder,
> > example.
> this doesn't really save typing - instead of typing self you have to
> type the local declaration. worse, this introduces extra syntax (after
> all, you still need ".").
> but more importantly, having "self" is good for the soul. in most other
> languages objects function in some "magical" manner. having self makes
> the mechanism clear - which is helpful both to newbies understanding OOP
> for the first time, and to fools like me that get easily confused when
> things happen behind their back...
> ps it doesn't have to be "self", afaik - you could use just "s" to save
> key presses.... :-)
Not to mention that most C++ coding standards require usage of 'm_' as a member
variable prefix, so if you shorten 'self.' to 's.' (or, even, 'm.'), you'd have
to do exactly the same amount of typing.
On the other hand I kinda like Visual Basic's 'with' construct. Consider:
.spam = "spam"
.eggs = arg1+arg2
Actually, for class methods that 'with ...:' could be <gasp> implicit.
More information about the Python-list