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

Christian Heimes lists@cheimes...
Mon Aug 18 18:06:42 CDT 2008


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*

Christian



More information about the Numpy-discussion mailing list