Do I always have to write "self." ?

Louis M. Pecora pecora at anvil.nrl.navy.mil
Thu Apr 27 17:06:38 EDT 2000


I am two weeks plus into learning Python and have started on a first
real project.  Amazing language.  BUT, now that I've gotten going with
classes, I'm finding I hate seeing all those  "self."  prefixes on the
class variables.  Python is generally very clean, but the classes I
write use a lot of "per-instance" variables, hence seem to require
self.  As a result the expressions can become cluttered and harder to
read than C++ in this particular case -- imagine that!  Is there any
relief here?  Any (simple) way around writing that self. every time?

Thanks.  Love Python so far otherwise.



More information about the Python-list mailing list