Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #38872
| References | <70c4a8a5-0e8d-4e5c-b0cd-e4ccd90c5cb3@googlegroups.com> <511D18C8.5040404@phihag.de> |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | 2013-02-14 11:05 -0700 |
| Subject | Re: any chance for contracts and invariants in Python? |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1772.1360865190.2939.python-list@python.org> (permalink) |
On Thu, Feb 14, 2013 at 10:03 AM, Philipp Hagemeister <phihag@phihag.de> wrote: > So any implementation has to choose one of the following: > > 1. Ignore invariants and postconditions of inherited classes - defeats > the purpose. > 2. Only respect definitions in classes and methods in the original > definition, which would be unpythonic > 3. Only respect the "original" definitions, for some value of original. > Simarily, this would break monkey patching. > 4. Update all subclasses whenever something changes. > 5. Traverse the entire class hierarchy for every method call. > > Which option should be picked? #5, with the expectation that like assertions the entire machinery would be turned off when the -O flag is passed, or perhaps even requiring a special flag to enable in the first place. Contracts and invariants would only be used in development work, not in production code.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
any chance for contracts and invariants in Python? mrkafk@gmail.com - 2013-02-14 03:42 -0800 Re: any chance for contracts and invariants in Python? Philipp Hagemeister <phihag@phihag.de> - 2013-02-14 18:03 +0100 Re: any chance for contracts and invariants in Python? Ian Kelly <ian.g.kelly@gmail.com> - 2013-02-14 11:05 -0700 Re: any chance for contracts and invariants in Python? MRAB <python@mrabarnett.plus.com> - 2013-02-14 18:18 +0000 Re: any chance for contracts and invariants in Python? Ethan Furman <ethan@stoneleaf.us> - 2013-02-14 10:33 -0800 Re: any chance for contracts and invariants in Python? Mark Janssen <dreamingforward@gmail.com> - 2013-02-14 18:33 -0800
csiph-web