Python Type-Inference based LINT.. (pylint.py)

Jeremy Hylton jeremy at cnri.reston.va.us
Fri Dec 3 12:16:37 EST 1999


>>>>> "SM" == Skip Montanaro <skip at mojam.com> writes:

  SM>     2. I'd add a few meta types that correspond to the API
  SM> behaviors (e.g., "number", "sequence", "mapping", ...).  That
  SM> would allow the type inferencer to make assumptions about the
  SM> behavior of an argument without the programmer enumerating all
  SM> the possible objects that could fill the bill.  These fake types
  SM> could be added to the types module and set equal to None.  All
  SM> you'd really be interested in is the names anyway (I think).

Here's a variation that I have been thinking about; not sure if it
makes sense.  Instead of having types that correspond to sequence,
mapping, etc. use a set of micro-types that apply to specific API
calls.  So a type might have __getitem__ and __len__.  It's not
unusual to have a user-defined class that only implements a few of the
methods you'd expect a sequence to have.

Jeremy





More information about the Python-list mailing list