encapsulation checking features

Steve Holden sholden at holdenweb.com
Mon Apr 14 17:39:42 EDT 2003


"Eric Scharff" <edsZZZ_2 at yahoo.com> wrote in message
news:3e9b1298 at cs.colorado.edu...
> I love python's semantics for rapid prototyping, but I was wondering if
> there was a way to turn on warnings so that for other kinds of code, I
> can avoid certain common uglinesses. :)
>
> Specifically, is there a "lint-like" tool to:
>
>  * warn if instance variables are created outside of a constructor?
>
>   class K:
>     def __init__(self):
>       self.a = 6  #okay
>     def example(self):
>       self.b = 66 # not as good
>
>   myVar = K()
>   myVar.c = 666  # really bad
>
>  * warn if instance variables are used outside of instance methods
>    (encouraging the use of getters and setters)
>
> These are great features to have, but it'd be nice to have warnings to
> discourage their use at times.
>

There's pychecker, but I don't know whether it specifically checks for thos
conditions. See

    http://pychecker.sf.net/

regards
--
Steve Holden                                  http://www.holdenweb.com/
How lucky am I?      http://www.google.com/search?q=Steve+Holden&btnI=1
Python Web Programming                 http://pydish.holdenweb.com/pwp/



>  (genuine email replies, remove ZZZ from email address)






More information about the Python-list mailing list