[Python-Dev] Return type of round, floor, and ceil in 2.6

2008-01-02 Thread Jeffrey Yasskin
I've been backporting pep 3141 to the trunk, and ran into the issue that round, math.floor, and math.ceil, which it specifies to return Integrals, currently return floats. Guido suggested privately that, to make sure that 2.6 is compatible with 2.5, they should keep returning floats for float argum

Re: [Python-Dev] Syntax suggestion for imports

2008-01-02 Thread Raymond Hettinger
[Jeroen Ruigrok van der Werven] > On the Trac project using your grep gives me 203 lines, if we take ~2 lines > for and after in consideration, it still means 203/5 ~= 40 occurences. Thanks. I'm more curious about the content of those lines. Does the proposed syntax help, does the need go away

Re: [Python-Dev] Syntax suggestion for imports

2008-01-02 Thread Michael Urman
On Jan 2, 2008 7:19 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > How about a new, simpler syntax: > > * import threading or dummy_threading as threading > > * import xml.etree.CElementTree or cElementTree or elementree.ElementTree as > ET > > * from cStringIO or StringIO import StringIO > >

Re: [Python-Dev] Syntax suggestion for imports

2008-01-02 Thread Jeroen Ruigrok van der Werven
-On [20080103 04:29], Raymond Hettinger ([EMAIL PROTECTED]) wrote: >Am curious to see what everyone else finds in their own code searches. On the Trac project using your grep gives me 203 lines, if we take ~2 lines for and after in consideration, it still means 203/5 ~= 40 occurences. -- Jeroen

Re: [Python-Dev] Syntax suggestion for imports

2008-01-02 Thread Raymond Hettinger
[GvR] > I wonder if your perceived need for this isn't skewed by your > working within the core? The need was perceived by a colleague who does not work on the core. My own skew was in the opposite direction -- I've seen the pattern so often that I'm oblivious to it. Before posting, I ran some

Re: [Python-Dev] Syntax suggestion for imports

2008-01-02 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Jan 2, 2008, at 9:08 PM, Aahz wrote: > On Wed, Jan 02, 2008, Raymond Hettinger wrote: >> >> The standard library, my personal code, third-party packages, and >> my employer's code base are filled with examples of the following >> pattern: >> >> try

Re: [Python-Dev] Syntax suggestion for imports

2008-01-02 Thread Terry Jones
> "John" == John Barham <[EMAIL PROTECTED]> writes: >> * import readline or emptymodule John> This I find more problematic as "emptymodule" seems too magical. John> Even now any code that wants to use a module that might not have been John> successfully imported needs to check if that's the c

Re: [Python-Dev] Syntax suggestion for imports

2008-01-02 Thread Aahz
On Wed, Jan 02, 2008, Raymond Hettinger wrote: > > The standard library, my personal code, third-party packages, and > my employer's code base are filled with examples of the following > pattern: > > try: >import threading > except ImportError: >import dummy_threading as threading > > How a

Re: [Python-Dev] Syntax suggestion for imports

2008-01-02 Thread Guido van Rossum
I wonder if your perceived need for this isn't skewed by your working within the core? Also, in 3.0 many of the use cases should go away -- e.g. cStringIO vs, StringIO, etc., as we switch the stdlib to having a single "public" name for an API which automatically replaces or augments itself with th

Re: [Python-Dev] Syntax suggestion for imports

2008-01-02 Thread John Barham
Raymond Hettinger wrote: > How about a new, simpler syntax: > > * import threading or dummy_threading as threading > * import xml.etree.CElementTree or cElementTree or elementree.ElementTree as > ET > * from cStringIO or StringIO import StringIO These all look good to me. The "short circuit" im

[Python-Dev] Syntax suggestion for imports

2008-01-02 Thread Raymond Hettinger
The standard library, my personal code, third-party packages, and my employer's code base are filled with examples of the following pattern: try: import threading except ImportError: import dummy_threading as threading try: import xml.etree.cElementTree as ET except ImportError: tr