Re: [Python-Dev] PEP 344: Exception Chaining and Embedded Tracebacks

2005-05-20 Thread Walter rwald
Michael Hudson wrote: > Walter Dörwald <[EMAIL PROTECTED]> writes: > >>Ka-Ping Yee wrote: >> >>>[...] >>>(a) ban string exceptions >>>(b) require all exceptions to derive from Exception >>>(c) ban bare "except:" >>>(d) eliminate sys.exc_* >> >>I think somewhere in this list should

Re: [Python-Dev] PEP 344: Exception Chaining and Embedded Tracebacks

2005-05-20 Thread Walter rwald
Ka-Ping Yee wrote: > [...] > (a) ban string exceptions > (b) require all exceptions to derive from Exception > (c) ban bare "except:" > (d) eliminate sys.exc_* I think somewhere in this list should be: (?) Remove string exceptions from the Python stdlib and perhaps:

Re: [Python-Dev] Generating nested data structures with blocks

2005-05-02 Thread Walter rwald
Walter Dörwald wrote: > [...] > def blist(list): > def enter(parent=None): Of course this was meant to be: class blist(list): der enter(self, parent=None): Bye, Walter Dörwald ___ Python-Dev mailing list Python-Dev@python.org http://mai

[Python-Dev] Generating nested data structures with blocks

2005-05-02 Thread Walter rwald
Reading PEP 340, it seems to me that blocks could be used for generating nested data structures: def blist(list): def enter(parent=None): if parent: parent.append(self) yield self x = blist() block x.enter() as x: x.append(1

Re: [Python-Dev] python-dev Summary for 2005-04-01 through 2005-04-15 [draft]

2005-04-18 Thread Walter rwald
Tim Lesher sagte: > Here's the first draft of the python-dev summary for the first half of April. > Please send any corrections or suggestions to > the summarizers. > [...] > > Unicode byte order mark decoding > >

Re: [Python-Dev] Unicode byte order mark decoding

2005-04-07 Thread Walter rwald
Walter Dörwald sagte: > Nicholas Bastin sagte: > > It should be feasible to implement your own codec for that > based on Lib/encodings/utf_16.py. Simply replace the line > in StreamReader.decode(): > raise UnicodeError,"UTF-16 stream does not start with BOM" > with: > self.decode = codecs.utf_

Re: [Python-Dev] Unicode byte order mark decoding

2005-04-07 Thread Walter rwald
Nicholas Bastin sagte: > On Apr 7, 2005, at 11:35 AM, M.-A. Lemburg wrote: > > [...] >> If you do have UTF-16 without a BOM mark it's much better >> to let a short function analyze the text by reading for first >> few bytes of the file and then make an educated guess based >> on the findings. You

Re: [Python-Dev] Unicode byte order mark decoding

2005-04-06 Thread Walter rwald
Stephen J. Turnbull wrote: "Martin" == Martin v Löwis <[EMAIL PROTECTED]> writes: Martin> I can't put these two paragraphs together. If you think Martin> that explicit is better than implicit, why do you not want Martin> to make different calls for the first chunk of a stream, Marti

Re: [Python-Dev] Unicode byte order mark decoding

2005-04-06 Thread Walter rwald
Martin v. Löwis sagte: > Walter Dörwald wrote: >> There are situations where the byte stream might be temporarily >> exhausted, e.g. an XML parser that tries to support the >> IncrementalParser interface, or when you want to decode >> encoded data piecewise, because you want to give a progress >> r

Re: [Python-Dev] Unicode byte order mark decoding

2005-04-05 Thread Walter rwald
Evan Jones sagte: > On Apr 5, 2005, at 15:33, Walter Dörwald wrote: >> The stateful decoder has a little problem: At least three bytes >> have to be available from the stream until the StreamReader >> decides whether these bytes are a BOM that has to be skipped. >> This means that if the file only

Re: [Python-Dev] Unicode byte order mark decoding

2005-04-05 Thread Walter rwald
Walter Dörwald sagte: > M.-A. Lemburg wrote: > >>> [...] >>>With the UTF-8-SIG codec, it would apply to all operation >>> modes of the codec, whether stream-based or from strings. Whether >>>or not to use the codec would be the application's choice. >> >> I'd suggest to use the same mode of operat

Re: [Python-Dev] Pickling instances of nested classes

2005-04-01 Thread Walter rwald
Samuele Pedroni wrote: [...] this should approximate that behavior better: [not tested] import sys def __new__(cls, name, bases, dic): sub = [x for x in dic.values() if isinstance(x,HierarchMeta)] newtype = type.__new__(cls, name, bases, dic) for x in sub: if not ha

Re: [Python-Dev] Pickling instances of nested classes

2005-04-01 Thread Walter rwald
Samuele Pedroni wrote: [...] And having the full name of the class available would certainly help in debugging. that's probably the only plus point but the names would be confusing wrt modules vs. classes. You'd propably need a different separator in repr. XIST does this: >>> from ll.xist.ns impo

Re: [Python-Dev] Pickling instances of nested classes

2005-03-31 Thread Walter rwald
Samuele Pedroni wrote: Walter Dörwald wrote: [User cases for pickling instances of nested classes] So is this change wanted? useful? implementable with reasonable effort? Or just not worth it? notice that in this cases often metaclasses are involved or could easely be, so if pickling would honor

Re: [Python-Dev] Pickling instances of nested classes

2005-03-31 Thread Walter rwald
Martin v. Löwis wrote: Walter Dörwald wrote: So is this change wanted? useful? implementable with reasonable effort? Or just not worth it? I think it is just not worth it. This means I won't attempt to implement it. I think I defined originally the __module__ attribute for classes to support bette

Re: [Python-Dev] New PyPI broken package editing

2005-03-31 Thread Walter rwald
Martin v. Löwis wrote: Walter Dörwald wrote: The register command in 2.4 (and current CVS) simply does a value = str(value) in post_to_server() so the encoded bytes sent depend on the default encoding. Would it be sufficient to change this to value = unicode(value).encode("utf-8") Indeed. I t

Re: [Python-Dev] New PyPI broken package editing

2005-03-30 Thread Walter rwald
Martin v. Löwis wrote: Walter Dörwald wrote: There's been a problem with your request exceptions.UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 92: ordinal not in range(128) That should be fixed now, please try again. Works perfectly, thanks! > [...] Bye, Walter Dörwald __

Re: [Python-Dev] New PyPI broken package editing

2005-03-30 Thread Walter rwald
Martin v. Löwis wrote: Walter Dörwald wrote: So can I have one setup.py for both Python 2.4 and Python 2.5 that does the correct thing when creating a Windows installer for Python 2.4 (I've used Unicode strings for that until now) and using the upload command with Python CVS (which seems to requi

[Python-Dev] Pickling instances of nested classes

2005-03-29 Thread Walter rwald
Currently instances of nested classes can't be pickled. For old style classes unpickling fails to find the class: >>> import cPickle >>> class Foo: ...class Bar: ... pass ... >>> cPickle.loads(cPickle.dumps(Foo.Bar())) Traceback (most recent call last): File "", line 1, in ? AttributeE

Re: [Python-Dev] New PyPI broken package editing

2005-03-29 Thread Walter rwald
Martin v. Löwis sagte: > Walter Dörwald wrote: >> I'm not sure if this is the right approach. > > I think the approach is right, but the implementation is wrong. > >> The encoding I specify in >> setup.py should be independent of the encoding used between distutils and >> PyPI to communicate on t

Re: [Python-Dev] New PyPI broken package editing

2005-03-23 Thread Walter rwald
[EMAIL PROTECTED] wrote: Zitat von Walter Dörwald <[EMAIL PROTECTED]>: I've uploaded a new package to the new PyPI. Editing this new packages gives me a unicode error. The URL is http://www.python.org/pypi?:action=submit_form&name=ll-ansistyle&version=0.6.1 I see that the package is online now, so

[Python-Dev] Re: [Python-checkins] python/dist/src/Doc/lib libcsv.tex, 1.18, 1.19

2005-03-18 Thread Walter rwald
[EMAIL PROTECTED] wrote: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22325 Modified Files: libcsv.tex Log Message: add UnicodeReader and UnicodeWriter example classes [] +The \module{csv} module doesn't directly support reading and

Re: [Python-Dev] __str__ vs. __unicode__

2005-02-24 Thread Walter rwald
Brett C. wrote: Walter Dörwald wrote: M.-A. Lemburg wrote: [...] I don't have a clear picture of what the consensus currently looks like :-) If we're going for for a solution that implements the hook awareness for all hooks, I'd be +1 on that. If we only touch the __unicode__ case, we'd only b

[Python-Dev] Negative indices in UserString.MutableString

2005-02-17 Thread Walter rwald
Currently UserString.MutableString does not support negative indices: >>> import UserString >>> UserString.MutableString("foo")[-1] = "bar" Traceback (most recent call last): File "", line 1, in ? File "/home/Python-test/dist/src/Lib/UserString.py", line 149, in __setitem__ if index < 0 or

Re: [Python-Dev] [ python-Bugs-1124637 ] test_subprocess is far too slow (fwd)

2005-02-17 Thread Walter rwald
Guido van Rossum wrote: [...] There used to be a farm of machines that did nothing but run the test suite ("snake-farm"). This seems to have stopped (it was run by volunteers at a Swedish university). Maybe we should revive such an effort, and make sure it runs with -u all. I've changed the job tha