Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'context': 0.04; 'subject:based': 0.07; 'subject:code': 0.07; 'runtime': 0.09; 'supported,': 0.09; 'library': 0.13; 'cc:addr:python-list': 0.15; 'subject: \n ': 0.16; 'subject:release': 0.16; 'valueerror': 0.16; 'wrote:': 0.16; 'jan': 0.19; 'header:In-Reply-To:1': 0.22; 'static': 0.24; 'cc:2**0': 0.25; '(in': 0.26; 'pm,': 0.26; 'function': 0.27; "i'm": 0.27; 'raise': 0.28; 'message- id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.29; 'received:209.85.210.46': 0.30; 'received:mail- pz0-f46.google.com': 0.30; 'thu,': 0.32; 'sort': 0.32; 'probably': 0.35; 'checks': 0.36; 'skip:" 10': 0.36; 'received:google.com': 0.37; 'could': 0.37; 'received:209.85': 0.38; 'think': 0.38; 'either': 0.39; 'received:209': 0.39; 'subject:: ': 0.39; 'design': 0.61; 'managers': 0.62; '26,': 0.67; 'designed': 0.68; 'constraint': 0.84; 'literature': 0.84; 'nathan': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=vdiS08RC8QeEYZw8O9fOXel0arFdKLV5NL0fgNjDWF8=; b=ohx8nOb06Rgp9uELOtmdU51A56Ri0UKLZEfIO1g+oyBD52y3Wn1EQWRWiHOHygjLe4 WsV7Yj4Tpqmll6+npBNqWO/3X7F14Scfc2EKhrSNRBUOVBwORrugIhk1MLwK3E/UFg21 oLcok24sg2bUcAcUWsDnh80bxgVqIEXwRl+IM= MIME-Version: 1.0 In-Reply-To: References: From: Devin Jeanpierre Date: Thu, 26 Jan 2012 14:51:30 -0500 Subject: Re: Constraints -//- first release -//- Flexible abstract class based validation for attributes, functions and code blocks To: Nathan Rice Content-Type: text/plain; charset=UTF-8 Cc: python-list X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1327607533 news.xs4all.nl 6867 [2001:888:2000:d::a6]:50845 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:19500 Ooh, runtime turing-complete dependent-types. :) I'm not sure if you're aware of the literature on this sort of thing. It's nice reading. A library such as this that's designed for it could be used for static checks as well. Probably deserves a better name than "constraintslib", that makes one think of constraint satisfaction. On Thu, Jan 26, 2012 at 2:36 PM, Nathan Rice wrote: > Design by contract style preconditions, postconditions and invariants are also > supported, and can be used either as context managers or function decorators:: Any way to get them to raise a different error, such as ValueError (in particular for preconditions)? -- Devin