"self" vs other names
Tim Hammerquist
tim at vegeta.ath.cx
Tue Oct 2 21:07:10 EDT 2001
More information about the Python-list mailing list
Tue Oct 2 21:07:10 EDT 2001
- Previous message (by thread): "self" vs other names
- Next message (by thread): "self" vs other names
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Me parece que Courageous <jkraska at san.rr.com> dijo: > On Thu, 27 Sep 2001 13:20:05 -0700 (PDT), "Sean 'Shaleh' Perry" <shalehperry at home.com> > wrote: > > >> > >> Again, which code reads more easily is a matter of taste. I just thought > >> I'd mention the possibility. > >> > > > >not that I subscribe to this, but another common form is simply 's'. You get > >things like 's.dict' or 's.pid'. > > I sometimes use a one letter abbreviation of the object type: > > class matrix: > > def f(m): > > pass > > > C// I most often use 'self' for consistency between programmers, JIC someone else has to maintain my code. OTOH, when dealing with man object attributes I often set the local var d equal to self.__dict__. It comes in handy a lot. It's alot easier to type repeatedly, and it sometimes forces me to come up with more illustrative names for any var that might start with d. Sometimes those old BASIC habits are hard to break... INPUT A PRINT @ 33 "A STRING" And there are only 26-52 vars available, each allowed only a one-letter identifier. Ya know, sometimes I really _don't_ miss my old TRS-80. It didn't have Python! It's amazing how something like a TRS-80 was sooo cool at the time, and now I cringe at the thought. What would the world have been like if CP/M had won over (PC|MS)-DOS? <you-don't-have-to-be-Microsoft-to-suck...but-it-helps>'ly 'yrs Tim Hammerquist -- Did I listen to pop music because I was miserable... Or was I miserable because I listened to pop music? -- John Cusack, "High Fidelity"
- Previous message (by thread): "self" vs other names
- Next message (by thread): "self" vs other names
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list