Python complaints

skaller skaller at maxtal.com.au
Tue Nov 30 09:39:58 EST 1999


Will Ware wrote:

> The reasoning leaned heavily on functions
> for the successor and predecessor of an integer. Conceivably there
> might be some value in adding successor and predecessor functions to
> immutable types where they had obvious meanings. Not that I ever do
> number theory myself, nor am I aware of anybody using Python for it,
> so this isn't a wish list thing, this is just idle conjecture.

Succ and pred were the FIRST, the VERY FIRST, methods added
to any viper type....

# This module is exclusive to Viper
# It is a builtin module, defining classes for all
# the Python types.
#
# Methods and attributes for objects can be found in the
# class dictionary of the typing class, even when the object
# is not a PyInstance of the class.
import string
import sys

# datum types
class PyIntType : 
  def succ(x): return x + 1
  def pred(x): return x - 1

.....

mainly because they were easy to implement :-)

-- 
John Skaller, mailto:skaller at maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia
homepage: http://www.maxtal.com.au/~skaller
voice: 61-2-9660-0850




More information about the Python-list mailing list