Why no number methods?

Michael Hudson mwh at python.net
Mon May 14 12:17:46 EDT 2001


"Magnus Lie Hetland" <mlh at idi.ntnu.no> writes:

> "Michael Hudson" <mwh at python.net> wrote in message
> news:Pine.LNX.4.30.0105141203140.24801-100000 at localhost.localdomain...
> > On Mon, 14 May 2001, Magnus Lie Hetland wrote:
> [...]
> > As said above, no real reason.  It's not obvious to me that it buys one
> > much though (this could be because strings have more in the way of
> > internal structure than floats or ints - if you know the value of a
> > number, that's about all you need, whereas it's reasonable to ask a string
> > "how many 'e's are there in you".  Just waffling, but there have been
> > times I'd have liked a .bitlength() method on longs).
> 
> I guess I agree that it isn't all *that* useful... I just nostalgically
> remember SmallTalks uncompromisingly consistent mechanism -- and noticed
> that Ruby was quite similar... I just think it would be neat to be able
> to explain the main syntax/semantics in a few lines (such as the
> object calculus of Abadi & Cardelli in "A Theory of Objects"). 

Neat, yes, but helpful in any real way?  I'm less sure.  I mean, being
able to understand Python semantics in five rather than twenty seconds
is an improvement, but neither is a very long time.  Oh, I don't know,
maybe I should stop rambling.

[...]
> > If 2.2 == 3000 (I don't think fp arithmetic is *that* inaccurate <wink>)
> > you *may* get your wish.
> 
> Well -- from Guido's preface to the newest "Programming in Python"
> this seems highly unlikely ;)

Really?  Haven't read that.

[...]
> > Did you read my last python-dev summary?
> 
> Errr... No. Perhaps I should?

Well, assume that we have magically healed the type/class split so
that all objects behave like instances.  Then imagine:

class C:
    def __repr__(self):
        return "bongle"

What's C.__repr__?  Quick!

Cheers,
M.

-- 
  Sufficiently advanced political correctness is indistinguishable
  from irony.                                           -- Erik Naggum



More information about the Python-list mailing list