Re: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects

2006-12-08 Thread Alastair Houghton
On 7 Dec 2006, at 21:47, Josiah Carlson wrote: Alastair Houghton [EMAIL PROTECTED] wrote: On 7 Dec 2006, at 02:01, Josiah Carlson wrote: Alastair Houghton [EMAIL PROTECTED] wrote: On 7 Dec 2006, at 01:01, Josiah Carlson wrote: If we don't want slicing, or if prodicing a slice would produce

Re: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects

2006-12-08 Thread Alastair Houghton
On 8 Dec 2006, at 16:38, Josiah Carlson wrote: My statement in the email you replied to above was to say that if we wanted it to return a group, then we could include subsequent .group (0) with the same semantics as the original match object. And my reply was simply to point out that that's

Re: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects

2006-12-07 Thread Alastair Houghton
On 7 Dec 2006, at 02:01, Josiah Carlson wrote: Alastair Houghton [EMAIL PROTECTED] wrote: On 7 Dec 2006, at 01:01, Josiah Carlson wrote: If we don't want slicing, or if prodicing a slice would produce a semantically questionable state, then lets not do it. ...if you return match objects

Re: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects

2006-12-07 Thread Alastair Houghton
On 7 Dec 2006, at 07:15, Fredrik Lundh wrote: Michael Urman wrote: The idea that slicing a match object should produce a match object sounds like a foolish consistency to me. well, the idea that adding m[x] as a convenience alias for m.group(x) automatically turns m into a list-style

Re: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects

2006-12-07 Thread Alastair Houghton
On 7 Dec 2006, at 18:54, Martin v. Löwis wrote: Alastair Houghton schrieb: How about we remove the word foolish from the debate? We should table the debate. If you really want that feature, write a PEP. You want it, some people are opposed; a PEP is the procedure to settle the difference

Re: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects

2006-12-06 Thread Alastair Houghton
On 5 Dec 2006, at 15:51, Fredrik Lundh wrote: Alastair Houghton wrote: What's more, I think it will be confusing for Python newbies because they'll see someone doing m[3] and assume that m is a list-like object, then complain when things like for match in m: print match

Re: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects

2006-12-06 Thread Alastair Houghton
On 6 Dec 2006, at 20:29, Josiah Carlson wrote: The problem is that either we return a list (easy), or we return something that is basically another match object (not quite so easy). Either way, we would be confusing one set of users or another. By not including slicing functionality by

Re: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects

2006-12-06 Thread Alastair Houghton
On 7 Dec 2006, at 00:39, Mike Klaas wrote: Keep in mind when implementing that m[3:4] should contain only the element at index 3, not both 3 and 4, as you've seemed to imply twice. Yes, you're quite right. I was writing off the top of my head and I'm still a relative newbie to Python

Re: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects

2006-12-06 Thread Alastair Houghton
On 7 Dec 2006, at 01:01, Josiah Carlson wrote: *We* may not be confused, but it's not about us (I'm personally happy to use the .group() interface); it's about relative newbies who, generally speaking, desire/need consistency (see [1] for a paper showing that certain kinds of

Re: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects

2006-12-05 Thread Alastair Houghton
On 5 Dec 2006, at 09:02, Ben Wing wrote: Fredrik Lundh wrote: Ka-Ping Yee wrote: taking everything into account, I think we should simply map __getitem__ to group, and stop there. no len(), no slicing, no sequence or mapping semantics. if people want full sequence behaviour with len

Re: [Python-Dev] Security Advisory for unicode repr() bug?

2006-10-08 Thread Alastair Houghton
On Oct 7, 2006, at 3:36 PM, M.-A. Lemburg wrote: Georg Brandl wrote: [EMAIL PROTECTED] wrote: I don't know if Apple has picked up on it (or if the version they currently distribute is affected - 2.3.5 built Oct 5 2005). Note that the bug refers to a UCS4 Python build. Most Linux distros

Re: [Python-Dev] Caching float(0.0)

2006-10-04 Thread Alastair Houghton
On 4 Oct 2006, at 06:34, Martin v. Löwis wrote: Alastair Houghton schrieb: On 3 Oct 2006, at 17:47, James Y Knight wrote: On Oct 3, 2006, at 8:30 AM, Martin v. Löwis wrote: As Michael Hudson observed, this is difficult to implement, though: You can't distinguish between -0.0 and +0.0 easily

Re: [Python-Dev] Caching float(0.0)

2006-10-04 Thread Alastair Houghton
On 4 Oct 2006, at 02:38, Josiah Carlson wrote: Alastair Houghton [EMAIL PROTECTED] wrote: There is, of course, the option of examining their representations in memory (I described the general technique in another posting on this thread). From what I understand of IEEE 764 FP doubles, -0.0

Re: [Python-Dev] Caching float(0.0)

2006-10-04 Thread Alastair Houghton
On Oct 4, 2006, at 8:14 PM, Martin v. Löwis wrote: If it breaks a few systems, that already is some systems too many. Python should never crash; and we have no control over the floating point exception handling in any portable manner. You're quite right, though there is already plenty of

Re: [Python-Dev] Caching float(0.0)

2006-10-03 Thread Alastair Houghton
On 3 Oct 2006, at 17:47, James Y Knight wrote: On Oct 3, 2006, at 8:30 AM, Martin v. Löwis wrote: As Michael Hudson observed, this is difficult to implement, though: You can't distinguish between -0.0 and +0.0 easily, yet you should. Of course you can. It's absolutely trivial. The only part