[Python-Dev] n.numbits: method or property?

Terry Reedy tjreedy at udel.edu
Wed Nov 12 04:28:07 CET 2008

Mike Klaas wrote:
> On 11-Nov-08, at 4:16 PM, Mark Dickinson wrote:
>> More generally, what are the guidelines for determining
>> when it's appropriate to make something a property rather
>> than a method?
> Both are awkward on numeric types in python, necessitating brackets or a 
> space before the dot:
> (1).__doc__
> 1 .__doc__
> I'd suggest a third alternative, which is a standalone function in math:
> from math import numbits:
> numbits(1)

Math is pretty much float, not int functions.

More information about the Python-Dev mailing list