Re: [Python-Dev] Re: Zen of Python

2005-01-20 Thread Alex Martelli
On 2005 Jan 20, at 02:47, Skip Montanaro wrote: Phillip Actually, this is one of those rare cases where optimization Phillip and clarity go hand in hand. Human brains just don't handle Phillip nesting that well. It's easy to visualize two levels of nested Phillip structure,

[Python-Dev] Re: Unix line endings required for PyRun* breaking embedded Python

2005-01-20 Thread Fredrik Lundh
Just van Rossum wrote: I don't think that in general you want to fold multiple empty lines into one. This would be my prefered regex: s = re.sub(r\r\n?, \n, s) Catches both DOS and old-style Mac line endings. Alternatively, you can use s.splitlines(): s = \n.join(s.splitlines()) +

Re: [Python-Dev] Updated Monkey Typing pre-PEP

2005-01-20 Thread Guido van Rossum
[Phillip J. Eby] I've revised the draft today to simplify the terminology, discussing only two broad classes of adapters. Since Clark's pending proposals for PEP 246 align well with the concept of extenders vs. independent adapters, I've refocused my PEP to focus exclusively on adding support

Re: [Python-Dev] Updated Monkey Typing pre-PEP

2005-01-20 Thread Mark Russell
On Thu, 2005-01-20 at 11:07, Guido van Rossum wrote: I'd also like to explore ways of creating partial interfaces on the fly. For example, if we need only the read() and readlines() methods of the file protocol, maybe we could declare that as follows:: def foo(f: file['read',

Re: [Python-Dev] Getting rid of unbound methods: patch available

2005-01-20 Thread Armin Rigo
Hi, Removing unbound methods also breaks the 'py' lib quite a bit. The 'py.test' framework handles function and bound/unbound method objects all over the place, and uses introspection on them, as they are the objects defining the tests to run. It's nothing that can't be repaired, and at

Re: [Python-Dev] Re: Unix line endings required for PyRun* breaking embedded Python

2005-01-20 Thread Skip Montanaro
Fredrik s = s.replace(\r, \n[\n in s:]) This fails on admittedly weird strings that mix line endings: s = abc\rdef\r\n s = s.replace(\r, \n[\n in s:]) s 'abcdef\n' where universal newline mode or Just's re.sub() gadget would work. Skip

Re: [Python-Dev] Unix line endings required for PyRun* breaking embedded Python

2005-01-20 Thread Skip Montanaro
Just Skip Montanaro wrote: Just re.sub([\r\n]+, \n, s) and I think you're good to go. Just I don't think that in general you want to fold multiple empty Just lines into one. Whoops. Yes. Skip ___ Python-Dev mailing list

Re: [Python-Dev] Updated Monkey Typing pre-PEP

2005-01-20 Thread Phillip J. Eby
At 03:07 AM 1/20/05 -0800, Guido van Rossum wrote: Phillip worries that solving this with interfaces would cause a proliferation of partial sequence interfaces representing the needs of various libraries. Part of his proposal comes down to having a way to declare that some class C implements some

Re: [Python-Dev] a bunch of Patch reviews

2005-01-20 Thread Martin v. Lwis
Irmen de Jong wrote: That sounds very convenient, thanks. Ok, welcome to the project! Please let me know whether it works. Does the status of 'python project member' come with certain expectations that must be complied with ? ;-) There are a few conventions that are followed more or less

Re: [Python-Dev] a bunch of Patch reviews

2005-01-20 Thread Tim Peters
[Martin v. Löwis] ... - Add an entry to Misc/NEWS, if there is a new feature, or if it is a bug fix for a maintenance branch (I personally don't list bug fixed in the HEAD revision, but others apparently do) You should. In part this is to comply with license requirements: we're a

RE: [Python-Dev] Updated Monkey Typing pre-PEP

2005-01-20 Thread Raymond Hettinger
[Guido van Rossum] There's one other problem that Phillip tries to tackle in his proposal: how to implement the rich version of an interface if all you've got is a partial implementation (e.g. you might have readline() but you need readlines()). I think this problem is worthy of a solution,

Re: [Python-Dev] Strange segfault in Python threads and linux kernel 2.6

2005-01-20 Thread Donovan Baarda
On Thu, 2005-01-20 at 14:12 +, Michael Hudson wrote: Donovan Baarda [EMAIL PROTECTED] writes: On Wed, 2005-01-19 at 13:37 +, Michael Hudson wrote: Donovan Baarda [EMAIL PROTECTED] writes: [...] The main oddness about python threads (before 2.3) is that they run with all signals

Re: [Python-Dev] Getting rid of unbound methods: patch available

2005-01-20 Thread Noam Raphael
Hello, I would like to add here another small thing which I encountered this week, and seems to follow the same logic as does Guido's proposal. It's about staticmethods. I was writing a class, and its pretty-printing method got a function for converting a value to a string as an argument. I

Re: [Python-Dev] Getting rid of unbound methods: patch available

2005-01-20 Thread Guido van Rossum
It's about staticmethods. I was writing a class, and its pretty-printing method got a function for converting a value to a string as an argument. I wanted to supply a default function. I thought that it should be in the namespace of the class, since its main use lies there. So I made it a

Re: [Python-Dev] Updated Monkey Typing pre-PEP

2005-01-20 Thread Guido van Rossum
Phillip, it looks like you're not going to give up. :) I really don't want to accept your proposal into core Python, but I think you ought to be able to implement everything you propose as part of PEAK (or whatever other framework). Therefore, rather than continuing to argue over the merits of

[Python-Dev] Patch review [ 1093585 ] sanity check for readline remove/replace

2005-01-20 Thread Michiel Jan Laurens de Hoon
Patch review [ 1093585 ] sanity check for readline remove/replace The functions remove_history_item and replace_history_item in the readline module respectively remove and replace an item in the history of commands. As outlined in bug [ 1086603 ], both functions cause a segmentation fault if the

Re: [Python-Dev] Unix line endings required for PyRun* breaking embedded Python

2005-01-20 Thread Stuart Bishop
Just van Rossum wrote: Skip Montanaro wrote: Just re.sub([\r\n]+, \n, s) and I think you're good to go. I don't think that in general you want to fold multiple empty lines into one. This would be my prefered regex: s = re.sub(r\r\n?, \n, s) Catches both DOS and old-style Mac line endings.

[Python-Dev] Re: Unix line endings required for PyRun* breakingembedded Python

2005-01-20 Thread Fredrik Lundh
Stuart Bishop wrote: Do people consider this a bug that should be fixed in Python 2.4.1 and Python 2.3.6 (if it ever exists), or is the resposibility for doing this transformation on the application that embeds Python? the text you quoted is pretty clear on this: It is envisioned

Re: [Python-Dev] Getting rid of unbound methods: patch available

2005-01-20 Thread Noam Raphael
and is more consistent with the general convention, that running A = B causes A == B to be true. Currently, Class.func = staticmethod(func), and Class.func = func, don't behave by this rule. If the suggestions are accepted, both will. Well, given that attribute assignment can be