Re: [Python-3000] Math in Python 3.0

2006-05-13 Thread Martin v. Löwis
Fredrik Johansson wrote: > Python's current numeric model has serious problems. Some of us (including myself) probably need enlightenment first: what are the serious problems specifically? > It's fine for > calculating with nothing but floats, or nothing but ints, but writing > code that works fo

Re: [Python-3000] What do do about IDLE?

2006-05-13 Thread Martin v. Löwis
Greg Ewing wrote: >> If the implication here is that there is *no* GUI in the Python >> standard library, I'd be cautious of this (-0, probably). Things like >> the pydoc server use a little GUI window. > > There *isn't* currently any GUI in the core distribution > except on Windows. Non-Windows u

Re: [Python-3000] Math in Python 3.0

2006-05-13 Thread Fredrik Johansson
On 5/13/06, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > It's fine for > > calculating with nothing but floats, or nothing but ints, but writing > > code that works for ints, floats, complexes *and* Decimals - let alone > > for custom types such as mpfs or numeric arrays - is nearly > > impossi

[Python-3000] Use case for generics

2006-05-13 Thread Talin
One way of thinking about generic functions is that they are the dynamic languages' equivalent to C++ function overloading. Now, there are lots of valid (and some not-so-valid) use cases for function overloading; I'm just going to pick one of the most common ones. Many GUI libraries have the co

Re: [Python-3000] Use case for generics

2006-05-13 Thread Edward Loper
Talin wrote: > One way of thinking about generic functions is that they are the dynamic > languages' equivalent to C++ function overloading. Now, there are lots > of valid (and some not-so-valid) use cases for function overloading; I'm > just going to pick one of the most common ones. > > Many

Re: [Python-3000] Math in Python 3.0

2006-05-13 Thread Nick Coghlan
Fredrik Johansson wrote: > For example, square roots are known as math.sqrt(x) for floats, > cmath.sqrt(x) for complex numbers, x.sqrt() for decimals, and > gmpy.sqrt(x)/gmpy.fsqrt(x) for gmpy's types. Oh, and SciPy has its own > sqrt function that works on arrays (but not Decimals or gmpy's types)

Re: [Python-3000] Use case for generics

2006-05-13 Thread Nick Coghlan
Edward Loper wrote: > (Note, this is not an argument against generic functions, which I think > definitely have their uses; just an argument that this isn't a use case > where I would choose to use them.) Agreed - the use cases I see for function overloading in Python are more in the domain whe

Re: [Python-3000] What do do about IDLE?

2006-05-13 Thread Greg Ewing
Martin v. Löwis wrote: > Or, perhaps, you are talking about the binary distributions > available from python.org? All binary distributions do include > Tkinter, including the Linux RPMs: My point was that not all platforms either come with Tk installed or have Tk in the Python binary installer, s

Re: [Python-3000] Use case for generics

2006-05-13 Thread Greg Ewing
Talin wrote: > r = Rectangle( x, y, w, h ) > r = Rectangle( minpos, maxpos ) > r = Rectangle( position, size ) This sort of thing is better done in Python using keyword arguments: Rectangle(left = x, top = y, width = w, height = h) Rectangle(topleft = (x, y), size = (w,h))

Re: [Python-3000] Function overloading (Math in Python 3.0)

2006-05-13 Thread Greg Ewing
Nick Coghlan wrote: > Py3k's function overloading should fix this: People are starting to talk about "Py3k's function overloading" as though it were a done deal. Has anything actually been decided about it yet. -- Greg ___ Python-3000 mailing list Pyth

Re: [Python-3000] Math in Python 3.0

2006-05-13 Thread Martin v. Löwis
Fredrik Johansson wrote: > For example, square roots are known as math.sqrt(x) for floats, > cmath.sqrt(x) for complex numbers, x.sqrt() for decimals, and > gmpy.sqrt(x)/gmpy.fsqrt(x) for gmpy's types. Oh, and SciPy has its own > sqrt function that works on arrays (but not Decimals or gmpy's types)

[Python-3000] Annotation classes (was: Questions on optional type annotations)

2006-05-13 Thread Collin Winter
On 5/12/06, Nick Coghlan <[EMAIL PROTECTED]> wrote: > Both of these (return type annotation and selecting strict or lenient > behaviour) can be done inline with the right methods on the annotation object. [snip] I've implemented this idea (a Function annotation, using Nick's suggestion) in typech

Re: [Python-3000] Math in Python 3.0

2006-05-13 Thread Martin v. Löwis
Nick Coghlan wrote: > Py3k's function overloading should fix this: > > @overloaded > def sqrt(value): > raise TypeError("Cannot take square root of %s" % type(value).__name__) > > @sqrt.overload > def sqrt_float(value : float): > return math.sqrt(value) > > @sqrt.overload > def sqrt_comp