Pascal int()

John W. Baxter jwbnews at scandaroon.com
Mon Mar 20 14:57:01 EST 2000


In article <38D66680.316F21D1 at roguewave.com>, Bjorn Pettersen 
<bjorn at roguewave.com> wrote:

> Gordon McMillan wrote:
> > [...]
> > I can assure you that no Python god, archangel, angel,
> > seraphim or cherubim would ever write anything but
> >  a = a + 1
> > 
> > - Gordon
> 
> ... of course, if P3K changed the meaning of 5 from "the object 5" to
> "a constructor for an Integer class, setting the value to 5" you could
> do all kinds of fun things, including:
> 
> 	a = 5
> 	a.inc()
> 
> And even though it would be backwards compatible, I don't really have
> high hopes for it being accepted (change? we don't need no stinking
> change ;-)
> 
> -- bjorn
> 

Nothing would prevent building an int wrapper similar to UserDict 
(except, perhaps, a slavish desire for performance of one's integers).  
The hypothetical UserInt's hypothetical subclass could certainly define 
the method inc().

Personally, I'd rather write a = a + 1.  I seldom used inc() whist 
writing Pascal, either, except for incrementing variables of types like 
(red, blue, green, khaki, oliveDrab).

(Various language implementations--some LISPs, some SmallTalks--show 
that by sacrificing some of the range of int, one can make int a class 
quite nicely.  I doubt that there would be many votes in favor of 
reducing int to 29 bits (or whatever).)

  --John

-- 
John W. Baxter   Port Ludlow, WA USA  jwbnews at scandaroon.com



More information about the Python-list mailing list