A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-November/083531.html below:

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

[Python-Dev] n.numbits: method or property? [Python-Dev] n.numbits: method or property?Mike Klaas mike.klaas at gmail.com
Wed Nov 12 02:59:12 CET 2008
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)

-Mike
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4