[Python-ideas] Symbolic expressions (or: partials and closures from the inside out) (original) (raw)
Chris Rebert pyideas at rebertia.com
Fri Jan 13 07:22:26 CET 2012
- Previous message: [Python-ideas] Symbolic expressions (or: partials and closures from the inside out)
- Next message: [Python-ideas] Symbolic expressions (or: partials and closures from the inside out)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Jan 12, 2012 at 3:03 PM, Terry Reedy <tjreedy at udel.edu> wrote:
On 1/12/2012 3:45 PM, Nathan Rice wrote:
print isinstance(3, const) True A Contraints instance defines a set. 'const' is the set 'oddge3' It would look better if you used standard syntax and do the inclusion check in a contains method. 3 in oddge3 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).
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
- Previous message: [Python-ideas] Symbolic expressions (or: partials and closures from the inside out)
- Next message: [Python-ideas] Symbolic expressions (or: partials and closures from the inside out)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]