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


Groups > comp.lang.python > #110611

Re: __all__ attribute: bug and proposal

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: __all__ attribute: bug and proposal
Date Tue, 28 Jun 2016 07:32:42 +1000
Lines 20
Message-ID <mailman.44.1467063171.2358.python-list@python.org> (permalink)
References <d5e97a5e-6f10-4e3f-ab24-113632f16f29@googlegroups.com> <CAPTjJmoyWedd6oFURX+URsxEo6hCcnGGxBs3DTDUnODrxWgzJQ@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de TZQn34WsTGj/UT27mS0oTQsTnQq5B9eUkLp5tTC1h72w==
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:bug': 0.05; 'cc:addr:python-list': 0.09; '__all__': 0.09; 'integers': 0.09; 'pavel': 0.09; 'typeerror:': 0.09; '2016': 0.16; '6:56': 0.16; 'earlier:': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'name),': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'attribute': 0.18; 'string,': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'pass': 0.22; 'am,': 0.23; '(you': 0.23; 'import': 0.24; 'header :In-Reply-To:1': 0.24; 'module': 0.25; 'message- id:@mail.gmail.com': 0.27; 'directly,': 0.29; 'objects': 0.29; 'classes': 0.30; 'work.': 0.30; 'putting': 0.30; 'class': 0.33; 'foo': 0.33; 'tue,': 0.34; 'received:google.com': 0.35; 'could': 0.35; 'but': 0.36; 'possible': 0.36; 'subject:: ': 0.37; 'names': 0.38; 'note:': 0.66; '(a,': 0.84; 'chrisa': 0.84; 'to:none': 0.91; 'canonical': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc; bh=ERco+HU/ZwoYOmqh0jqhlORWw7dPd7KcJxrfbAIg+LA=; b=TRh9MR2ykJqsWNSkG5P+zRKGlKgmYZ5Z8RUmK8De/LteU8yFt5PXN4yNURfS2UFPDe 29WbQrzsT+JejEfgQYwh/MVx0y7SSrWqYuqQD22m6e48x5KhIfWTXzqxWXkq3UBx9ekV osSijrR8ZcIjAtOEFPZ2iMusfICojKGt+FbgLnWJtmhvF1DJpXC0mS/yeZ09ijlcbIIO DdaLDW5u3aBsWCR4ULnt8rp2IkBWI5p5fJY4t6q4dzrYUsrXF9qI9V5MBux0lmXsZPtq O1cQTzGCKDz/RKRpsMn8fEJCzulxZygXG9RQgo8SY0DORQC7WLZ8bgAiTX4KWsq5KVLI CA/w==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc; bh=ERco+HU/ZwoYOmqh0jqhlORWw7dPd7KcJxrfbAIg+LA=; b=mwiTMccHj0vjdZOgr7enuuAk1zRfNd9b62l26PQTdNstuGqB+FN3uom8t0z0kvZ6am h6tL2XEYkRJZ4w/sI3sI977+K5cZSJ9Pi3jINh306kopuP6eOdU87yTYYcrS9zia2bMs jm4HhnQEWVkkHljiACettyyfobHOi7JE/p9ApxYpX6QBnMUsg/God4UUYmy0g3TJJpe3 LFZDU5x4X4sOsu7vcYTWiN83GZ/mA9f7lShYB6lB23kw6ZtLV7oqJHWC1HRWRqqbqwVi 5yHQURlqL9xBArGRynLVa+gTf9qh6bdC57NKcbJTRRSJQOK+Ln2lEVfPKj87+VGPVJxI tyDA==
X-Gm-Message-State ALyK8tJtzmoZi6xLY0awE/9FG65DP8JMZc7psfoJWZGExoccgM4ZI/7IMYg+FmQYToAEhGulm8ForingwrHehg==
X-Received by 10.28.30.149 with SMTP id e143mr12097727wme.81.1467063163849; Mon, 27 Jun 2016 14:32:43 -0700 (PDT)
In-Reply-To <d5e97a5e-6f10-4e3f-ab24-113632f16f29@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
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>
X-Mailman-Original-Message-ID <CAPTjJmoyWedd6oFURX+URsxEo6hCcnGGxBs3DTDUnODrxWgzJQ@mail.gmail.com>
X-Mailman-Original-References <d5e97a5e-6f10-4e3f-ab24-113632f16f29@googlegroups.com>
Xref csiph.com comp.lang.python:110611

Show key headers only | View raw


On Tue, Jun 28, 2016 at 6:56 AM, Pavel S <pavel@schon.cz> wrote:
> Porposal: allow putting objects into __all__ directly, so possible problems will be found earlier:
>
> # module foo.py
> class A: pass
> class B: pass
> class C: pass
>
> __all__ = (A, B, C)
>
> Note: this currently don't work.
>
>>>> from foo import *
> TypeError: attribute name must be string, not 'type'

How would it know what names to import them under? It's all very well
with classes and functions (you could mandate that it uses the
canonical name), but what about integers or strings?

ChrisA

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


Thread

__all__ attribute: bug and proposal Pavel S <pavel@schon.cz> - 2016-06-27 13:56 -0700
  Re: __all__ attribute: bug and proposal Chris Angelico <rosuav@gmail.com> - 2016-06-28 07:32 +1000
    Re: __all__ attribute: bug and proposal Pavel S <pavel@schon.cz> - 2016-06-27 15:29 -0700
      Re: __all__ attribute: bug and proposal Chris Angelico <rosuav@gmail.com> - 2016-06-28 08:41 +1000
      Re: __all__ attribute: bug and proposal Terry Reedy <tjreedy@udel.edu> - 2016-06-27 22:46 -0400
        Re: __all__ attribute: bug and proposal Steven D'Aprano <steve@pearwood.info> - 2016-06-28 13:24 +1000
  Re: __all__ attribute: bug and proposal Random832 <random832@fastmail.com> - 2016-06-27 20:25 -0400
  Re: __all__ attribute: bug and proposal Chris Angelico <rosuav@gmail.com> - 2016-06-28 10:32 +1000
  Re: __all__ attribute: bug and proposal MRAB <python@mrabarnett.plus.com> - 2016-06-28 02:55 +0100
  Re: __all__ attribute: bug and proposal Steven D'Aprano <steve@pearwood.info> - 2016-06-28 11:56 +1000
  Re: __all__ attribute: bug and proposal Chris Angelico <rosuav@gmail.com> - 2016-06-28 12:20 +1000
  Re: __all__ attribute: bug and proposal Random832 <random832@fastmail.com> - 2016-06-27 22:27 -0400
  Re: __all__ attribute: bug and proposal Zachary Ware <zachary.ware+pylist@gmail.com> - 2016-06-27 23:31 -0500
  Re: __all__ attribute: bug and proposal Ethan Furman <ethan@stoneleaf.us> - 2016-06-28 08:29 -0700

csiph-web