Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #59910

Re: Why do only callable objects get a __name__?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; '"if': 0.09; "'python": 0.09; '__name__': 0.09; 'executed': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:Why': 0.09; 'jan': 0.12; 'callable': 0.16; 'imported.': 0.16; 'merely': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'wrote:': 0.18; 'module': 0.19; 'command': 0.22; 'this?': 0.23; 'header:User-Agent:1': 0.23; 'header:X-Complaints- To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'statement': 0.30; "skip:' 10": 0.31; 'file': 0.32; 'run': 0.32; 'common': 0.35; 'objects': 0.35; 'there': 0.35; 'subject:?': 0.36; 'being': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'expression': 0.60; 'john': 0.61; 'received:173': 0.61; 'name': 0.63; 'determine': 0.67; 'subject': 0.69; 'special': 0.74; 'subject:get': 0.81; 'received:fios.verizon.net': 0.84; 'mistake': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: Why do only callable objects get a __name__?
Date Mon, 18 Nov 2013 16:11:08 -0500
References <b8a1c0cb-a52e-466b-af2a-64059f4e8be3@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-173-59-117-133.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0
In-Reply-To <b8a1c0cb-a52e-466b-af2a-64059f4e8be3@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2865.1384809081.18130.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1384809081 news.xs4all.nl 15908 [2001:888:2000:d::a6]:58216
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:59910

Show key headers only | View raw


On 11/18/2013 3:13 PM, John Ladasky wrote:

> Of course, I have used __name__ for years in the common expression "if __name__ == "__main__") to determine whether a particular module is being run or merely imported.

This true statement invalidates your subject line ;-). All modules have 
a __name__. The main module has the name (__name__) '__main__'. (A file 
named '__main__.py' also has special meaning. If one does 'python -m 
package' on a command line and 'package' is a directory with 
'__init__.py', 'package/__main__.py' is executed as the main module 
'__main__'.

> 1. WHY do only callable objects get a __name__?

Why do you think this? Is there a mistake in the doc?

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Why do only callable objects get a __name__? John Ladasky <john_ladasky@sbcglobal.net> - 2013-11-18 12:13 -0800
  Re: Why do only callable objects get a __name__? John Ladasky <john_ladasky@sbcglobal.net> - 2013-11-18 12:38 -0800
  Re: Why do only callable objects get a __name__? Ian Kelly <ian.g.kelly@gmail.com> - 2013-11-18 13:43 -0700
    Re: Why do only callable objects get a __name__? John Ladasky <john_ladasky@sbcglobal.net> - 2013-11-18 13:02 -0800
      Re: Why do only callable objects get a __name__? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-11-18 23:37 +0000
        Re: Why do only callable objects get a __name__? John Ladasky <john_ladasky@sbcglobal.net> - 2013-11-18 22:10 -0800
  Re: Why do only callable objects get a __name__? Terry Reedy <tjreedy@udel.edu> - 2013-11-18 16:11 -0500
    Re: Why do only callable objects get a __name__? John Ladasky <john_ladasky@sbcglobal.net> - 2013-11-18 13:26 -0800
  Re: Why do only callable objects get a __name__? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-11-18 23:21 +0000
    Re: Why do only callable objects get a __name__? John Ladasky <john_ladasky@sbcglobal.net> - 2013-11-18 22:36 -0800
      Re: Why do only callable objects get a __name__? Steven D'Aprano <steve@pearwood.info> - 2013-11-19 07:08 +0000

csiph-web