[Python-Dev] Work in progress - coercion/cmp overhaul
M.-A. Lemburg
mal@lemburg.com
Mon, 13 Nov 2000 16:32:04 +0100
Neil Schemenauer wrote:
>
> I making this available now in the hope that it will generate
> some dicussion:
>
> http://arctrix.com/nas/python/coerce-2.diff
>
> The patch is based on Marc-Andre Lemburg's coercion patch for
> 1.5.1 downloaded from the starship:
>
> http://starship.python.net/~lemburg/CoercionProposal.html
>
> All credit goes to him. The bugs are probably introduced by me.
> What the patch does:
>
> - Introduces a new type flag "NEWSYTLENUMBER". If this flag is
> set then the tp_as_number methods are treated differently.
> Coercion is not done before passing arguments to the method.
> New style methods do their own coercion or return the
> NotImplemented singleton. See Marc's page for more details.
Very nice !
I wanted to suggest the usage of a type flag
instead of the slot magic in the original patch too -- your time
machine was faster ;-)
> - Decide on handling of nb_coerce slot (eg. should it be called
> on new style numbers).
Probably not, since all coercion is now handled by the slots
themselves.
--
Marc-Andre Lemburg
______________________________________________________________________
Business: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/