Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #18899
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <chris@rebertia.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:: [': 0.02; 'subject:Python': 0.05; 'defines': 0.07; 'skip:` 10': 0.07; 'terry': 0.07; '>>>>': 0.09; 'subject:ideas': 0.09; 'classes,': 0.13; 'class,': 0.15; 'method.': 0.15; 'cc:addr:python-list': 0.15; 'syntax': 0.15; 'instances.': 0.16; 'modules).': 0.16; 'phrasing': 0.16; 'reedy': 0.16; 'remain,': 0.16; 'subject: \n ': 0.16; 'values?': 0.16; 'subject:] ': 0.16; 'wrote:': 0.16; 'instance': 0.18; 'jan': 0.19; 'cheers,': 0.20; 'checked': 0.20; 'header:In-Reply-To:1': 0.22; 'pm,': 0.26; 'message- id:@mail.gmail.com': 0.28; 'problem': 0.29; 'print': 0.29; 'cc:addr:python.org': 0.29; 'seem': 0.29; 'chris': 0.30; 'pretty': 0.30; 'thu,': 0.32; 'received:209.85.214': 0.32; 'set.': 0.34; 'sets': 0.35; 'starting': 0.36; 'cc:2**1': 0.36; 'skip:" 10': 0.36; 'but': 0.37; "there's": 0.37; 'received:google.com': 0.37; 'using': 0.37; 'skip:_ 10': 0.37; 'received:209.85': 0.38; 'accepted': 0.38; 'e.g.': 0.38; 'subject:from': 0.39; 'subject: (': 0.39; 'received:209': 0.39; 'subject:: ': 0.39; 'types': 0.61; 'your': 0.61; 'constraint': 0.84; 'nathan': 0.84; 'sender:addr:chris': 0.84; 'url:rebertia': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=7gWb2CI7ruH8pZo4NGTkjbFoLPOMACHt0P0LiN4+wQ8=; b=BHT5SpYRtU1bvEOxjZWWYfXuGfKS/HcFyDdWuOqI74eZDERJLfpDHc3fb5mvSW3yRx nWDfsGqlVx4yX4j5N2wuj0nSjx5m2bK285vKqL+2NiFcP4bKgq0f0Ysp74L4DI5iK9Dk XKvCS9JGyrSLi5nd4PKwps0sH03QgOx9LUGWA= |
| MIME-Version | 1.0 |
| Sender | chris@rebertia.com |
| In-Reply-To | <jenos5$g8d$1@dough.gmane.org> |
| References | <CAOFbRmKxZ1RLs6b_taNAJ-4zVa+LG=5CWK5dwxTdL-TXfr9X2A@mail.gmail.com> <jenos5$g8d$1@dough.gmane.org> |
| Date | Thu, 12 Jan 2012 22:22:26 -0800 |
| X-Google-Sender-Auth | XRzvcPstnkk2oulPQQzPXdggnK4 |
| Subject | Re: [Python-ideas] Symbolic expressions (or: partials and closures from the inside out) |
| From | Chris Rebert <pyideas@rebertia.com> |
| To | Terry Reedy <tjreedy@udel.edu> |
| Content-Type | text/plain; charset=UTF-8 |
| Cc | python-list@python.org, python-ideas@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4699.1326435748.27778.python-list@python.org> (permalink) |
| Lines | 39 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1326435748 news.xs4all.nl 6934 [2001:888:2000:d::a6]:46467 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:18899 |
Show key headers only | View raw
On Thu, Jan 12, 2012 at 3:03 PM, Terry Reedy <tjreedy@udel.edu> wrote: > On 1/12/2012 3:45 PM, Nathan Rice wrote: <snip> >>>>> print isinstance(3, const) >> >> True > > > A Contraints instance defines a set. 'const' is the set 'odd_ge_3' > It would look better if you used standard syntax and do the inclusion check > in a __contains__ method. > >>>> 3 in odd_ge_3 > > True But what are types but abstract sets of values? Phrasing it as a typecheck is perfectly sensible from a type-theoretic standpoint. Also, the problem of representing `isinstance(X.attr, someclass)` [for non-Constraint someclass, e.g. str] in a Constraint would still remain, since there's no "__lcontains__" (thus precluding `X.attr in str`). <snip> >> so your validations are checked using __instancecheck__. > > But it is a fake check in that 3 is not really an instance of the class, > which has no instances. The same can be true for abstract base classes, which have been sufficiently accepted to warrant adding __instancecheck__() in the first place and also to be added to the std lib (witness the `abc` and `collections` modules). It may seem unfamiliar, but then again it was only made possible starting with v2.6, which is pretty recent. Cheers, Chris -- http://rebertia.com
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: [Python-ideas] Symbolic expressions (or: partials and closures from the inside out) Chris Rebert <pyideas@rebertia.com> - 2012-01-12 22:22 -0800
csiph-web