[Numpy-discussion] global overloading of 1+1 -> MyClass(1, 1)

Ondrej Certik ondrej at certik.cz
Mon Aug 18 19:44:21 EDT 2008


On Tue, Aug 19, 2008 at 1:06 AM, Christian Heimes <lists at cheimes.de> wrote:
> Andrew Dalke wrote:
>> When would this "with float ... " considered valid?
>
> [long posting]
>
> Oh h... what have I done ... *g*
>
> Slow down, please. For now there are no concrete plans what-so-ever to
> implement the feature in the near future. Some developers have expressed
> their interest in a way to alter the resulting type of a literal. It was
> my attention to show you, that we have discussed the idea, too.
>
> Now for the "with type as from import" syntax. I came up with the syntax
> idea about an hour ago. I tried to come up with some nice syntax that
> reuses existing keywords. IMHO it has a nice ring. Other possibilities I
> came up with:
>
>   def float as factory
>   def float as from module import factory
>   with float yield factory
>   with float yield from module import factory
>
> After some careful thinking I'm in favor of "with ... yield ...". It's
> less ambiguous and can't be mistaken for "with open(filename) as fh".
>
> The ideas needs a good PEP. You are definitely up to something. You also
> came up with a list of possible issues and corner cases. Are you
> interested in pursuing the proposal? *wink*

Are we able to provide an actual patch to Python that implements this?
If so, then I am.
Imho the proposal should come with an actual patch, otherwise it's
difficult to judge it.

Ondrej



More information about the NumPy-Discussion mailing list