[EMAIL PROTECTED] wrote: > Hi, > > With properties, attributes and methods seem very similar. I was > wondering what techniques people use to give clues to end users as to > which 'things' are methods and which are attributes. With ipython, I > use tab completion all the time, but I can rarely tell from the names > alone whether it is an attribute or method. > > Tips? Ideas? Best practices? > > Here is one idea: Ipython should color-code the tab completion based > on attributes and methods.
Sure. Import types and test, then color code based on the test result. For example: py> import types py> def doit(stuff): ... print stuff ... py> class Thing(object): ... def amethod(self): ... print 42 ... py> t = Thing() py> type(t.amethod) is types.MethodType True py> type(t.doit) is types.FunctionType True py> type(Thing.amethod) is types.UnboundMethodType True py> t.value = 4 py> type(t.value) not in (types.FunctionType, types.UnboundMethodType, types.MethodType) True James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com -- http://mail.python.org/mailman/listinfo/python-list