Subclassing int for a revolving control number

Paul McGuire ptmcg at austin.rr._bogus_.com
Sat Jul 17 02:16:18 EDT 2004


"Chris Cioffi" <evenprimes at gmail.com> wrote in message
news:mailman.508.1090008510.5135.python-list at python.org...
>
> I'm trying to subclass int such that once it reaches a certain value,
> it flips back to the starting count.  This is for use as an X12
> control number.
>  <remaining snipped...>

Why does this have to subclass int?  I think you are falling into the basic
object trap of confusing "is-a" and "is-implemented-using-a" that eventually
turns inheritance hierarchies into a semantic contortion.  Dan Sommers'
posted class looks to do just what you need, with no extra int baggage.

--  Paul





More information about the Python-list mailing list