[Python-Dev] basenumber redux (original) (raw)

Anthony Baxter anthony at interlink.com.au
Mon Jan 16 10:53:06 CET 2006


On Monday 16 January 2006 20:05, Nick Coghlan wrote:

For example, what's wrong with "hasattr(x, int)"? That works for all the builtin types, and, IMO, anyone defining a direct conversion to an integer for a non-numeric type deserves whatever happens to them.

What about something that's got something like:

def int(self): raise TypeError("This type is not a number!")

I don't see a problem with defining basenumber. For the use cases, pretty much the same set as basesstring.

-- Anthony Baxter <anthony at interlink.com.au> It's never too late to have a happy childhood.



More information about the Python-Dev mailing list