Re: [Python-Dev] Tkinter has many files

2009-08-06 Thread Terry Reedy
cool-RR wrote: Hello python-dev! I'm a Python programmer, but this is the first time I'm posting on python-dev, and I am not familiar at all with how the Python implementation works -- so this post may be way off. I've recently released a Python application, PythonTurtle

Re: [Python-Dev] (try-except) conditional expression similar to (if-else) conditional (PEP 308)

2009-08-06 Thread MRAB
Russell E. Owen wrote: In article , Xavier Morel wrote: On 6 Aug 2009, at 00:22 , Jeff McAninch wrote: I'm new to this list, so please excuse me if this topic has been discussed, but I didn't see anything similar in the archives. I very often want something like a try-except conditional e

Re: [Python-Dev] (try-except) conditional expression similar to (if-else) conditional (PEP 308)

2009-08-06 Thread MRAB
Dino Viehland wrote: MRAB wrote: Dino Viehland wrote: On option 1 is this legal then? x = float(string) except float('nan') if some_check() else float('inf') if ValueError Well, is this is legal? try: x = float(string) except some_check(): x = float('nan') ex

Re: [Python-Dev] (try-except) conditional expression similar to (if-else) conditional (PEP 308)

2009-08-06 Thread Dino Viehland
MRAB wrote: > Dino Viehland wrote: > > On option 1 is this legal then? > > > > x = float(string) except float('nan') if some_check() else float('inf') if > ValueError > > > Well, is this is legal? > > try: > x = float(string) > except some_check(): > x = float('nan') >

Re: [Python-Dev] (try-except) conditional expression similar to (if-else) conditional (PEP 308)

2009-08-06 Thread MRAB
Dino Viehland wrote: On option 1 is this legal then? x = float(string) except float('nan') if some_check() else float('inf') if ValueError Well, is this is legal? try: x = float(string) except some_check(): x = float('nan') except ValueError: x = float('in

Re: [Python-Dev] PEP 385: the eol-type issue

2009-08-06 Thread Neil Hodgson
M.-A. Lemburg: > ... and because of this, the feature is already available if > you use codecs.open() instead of the built-in open(): So should I not add an issue for the basic open because codecs.open should be used for this case? Neil ___ Pytho

[Python-Dev] issue 6654

2009-08-06 Thread Kristján Valur Jónsson
I added http://bugs.python.org/issue6654 I also put a not to python-ideas but have had no response yet. Any comments? Here's the summary: I've created http://codereview.appspot.com/100046 on Rietveld: by passing the "path" component of the xmlrpc request to the dispatch method, itbecomes possi

Re: [Python-Dev] (try-except) conditional expression similar to (if-else) conditional (PEP 308)

2009-08-06 Thread Dino Viehland
On option 1 is this legal then? x = float(string) except float('nan') if some_check() else float('inf') if ValueError -Original Message- From: python-dev-bounces+dinov=microsoft@python.org [mailto:python-dev-bounces+dinov=microsoft@python.org] On Behalf Of Nick Coghlan Sent: Th

Re: [Python-Dev] (try-except) conditional expression similar to (if-else) conditional (PEP 308)

2009-08-06 Thread Russell E. Owen
In article , Xavier Morel wrote: > On 6 Aug 2009, at 00:22 , Jeff McAninch wrote: > > I'm new to this list, so please excuse me if this topic has been > > discussed, but I didn't > > see anything similar in the archives. > > > > I very often want something like a try-except conditional express

Re: [Python-Dev] (try-except) conditional expression similar to (if-else) conditional (PEP 308)

2009-08-06 Thread Jeff McAninch
Nick Coghlan wrote: Option 1: Change the relative order of the clauses by putting the exception definition last: x = float(string) except float('nan') if ValueError op(float(string) except float('nan') if ValueError) I actually like this one (that's why I listed it first). It gets the clau

Re: [Python-Dev] Tkinter has many files

2009-08-06 Thread cool-RR
> > Why do you need to keep the whole Python distribution under version > control? Isn't all you need a script to *generate* the py2exe'd output from > an *installed* Python? This is the approach I take with Movable Python which > does something very similar. > > Never mind the source control issue

Re: [Python-Dev] Tkinter has many files

2009-08-06 Thread Michael Foord
cool-RR wrote: Hello python-dev! I'm a Python programmer, but this is the first time I'm posting on python-dev, and I am not familiar at all with how the Python implementation works -- so this post may be way off. I've recently released a Python application, PythonTurtle

[Python-Dev] Tkinter has many files

2009-08-06 Thread cool-RR
Hello python-dev! I'm a Python programmer, but this is the first time I'm posting on python-dev, and I am not familiar at all with how the Python implementation works -- so this post may be way off. I've recently released a Python application, PythonTurtle, which is packa

Re: [Python-Dev] (try-except) conditional expression similar to (if-else) conditional (PEP 308)

2009-08-06 Thread Eric Pruitt
What about catching specific error numbers? Maybe an option so that the dictionary elements can also be dictionaries with integers as the keys: filedata = try_3(open, randomfile, except = { IOError, {2: None} } ) If it isn't found in the dictionary, then we raise the error. On Thu, Aug 6, 2

[Python-Dev] (try-except) conditional expression similar to (if-else) conditional (PEP 308)

2009-08-06 Thread ilya
I took a look at the options 1 and 2: x = float(string) except float('nan') if ValueError y = float(string) except ValueError: float('nan') and I think this can be done just as easily with existing syntax: x = try_1(float, string, except_ = float('nan'), if_ = ValueError) y = try

Re: [Python-Dev] PEP 385: the eol-type issue

2009-08-06 Thread Antoine Pitrou
M.-A. Lemburg egenix.com> writes: > > Sure, but the code for line splitting is not really all that > complicated (see PyUnicode_Splitlines()), so could easily > be adapted to work on buffers directly. Certainly indeed. It all comes down to compatibility with the original implementation. (PEP 311

Re: [Python-Dev] (try-except) conditional expression similar to (if-else) conditional (PEP 308)

2009-08-06 Thread MRAB
Nick Coghlan wrote: P.J. Eby wrote: At 05:59 PM 8/5/2009 -0700, Raymond Hettinger wrote: [Jeffrey E. McAninch, PhD] I very often want something like a try-except conditional expression similar to the if-else conditional. An example of the proposed syntax might be: x = float(string) except

Re: [Python-Dev] (try-except) conditional expression similar to (if-else) conditional (PEP 308)

2009-08-06 Thread Xavier Morel
On 6 Aug 2009, at 00:22 , Jeff McAninch wrote: I'm new to this list, so please excuse me if this topic has been discussed, but I didn't see anything similar in the archives. I very often want something like a try-except conditional expression similar to the if-else conditional. I fear this

Re: [Python-Dev] PEP 385: the eol-type issue

2009-08-06 Thread M.-A. Lemburg
Antoine Pitrou wrote: > M.-A. Lemburg egenix.com> writes: >> >> What I don't understand is why the io layer tries to reinvent >> the wheel here instead of just using the codec's .readline() >> method - which *does* use .splitlines() and has full support >> for all Unicode line break characters (in

Re: [Python-Dev] (try-except) conditional expression si milar to (if-else) conditional (PEP 308)

2009-08-06 Thread Antoine Pitrou
Raymond Hettinger rcn.com> writes: > > For example: > >x = min(seq) except ValueError else 0 # default to zero for empty sequences How about: x = min(seq) if seq else 0 Shorter and more readable ("except X else Y" isn't very logical). > sample_std_deviation = sqrt(sum(x - mu for

Re: [Python-Dev] (try-except) conditional expression similar to (if-else) conditional (PEP 308)

2009-08-06 Thread Dj Gilcrease
On Thu, Aug 6, 2009 at 4:47 AM, Nick Coghlan wrote: > Option 2: >  x = float(string) except ValueError: float('nan') >  op(float(string) except ValueError: float('nan')) > > This has the virtue of closely matching the statement syntax, but > embedding colons inside expressions is somewhat ugly. Yes

Re: [Python-Dev] PEP 385: the eol-type issue

2009-08-06 Thread Antoine Pitrou
M.-A. Lemburg egenix.com> writes: > > What I don't understand is why the io layer tries to reinvent > the wheel here instead of just using the codec's .readline() > method - which *does* use .splitlines() and has full support > for all Unicode line break characters (including the CRLF > combinati

Re: [Python-Dev] (try-except) conditional expression similar to (if-else) conditional (PEP 308)

2009-08-06 Thread Nick Coghlan
P.J. Eby wrote: > At 05:59 PM 8/5/2009 -0700, Raymond Hettinger wrote: >> [Jeffrey E. McAninch, PhD] >>> I very often want something like a try-except conditional expression >>> similar >>> to the if-else conditional. >>> >>> An example of the proposed syntax might be: >>>x = float(string) exce

Re: [Python-Dev] PEP 385: the eol-type issue

2009-08-06 Thread M.-A. Lemburg
M.-A. Lemburg wrote: > Nick Coghlan wrote: >> Antoine Pitrou wrote: >>> M.-A. Lemburg egenix.com> writes: Please file a bug report for this. f.readlines() (or rather the io layer) should be using Py_UNICODE_ISLINEBREAK(ch) for detecting line break characters. >>> >>> Actually, no. I

Re: [Python-Dev] PEP 385: the eol-type issue

2009-08-06 Thread M.-A. Lemburg
Nick Coghlan wrote: > Antoine Pitrou wrote: >> M.-A. Lemburg egenix.com> writes: >>> Please file a bug report for this. f.readlines() (or rather >>> the io layer) should be using Py_UNICODE_ISLINEBREAK(ch) >>> for detecting line break characters. >> >> Actually, no. It has been designed from the s

Re: [Python-Dev] PEP 385: the eol-type issue

2009-08-06 Thread Nick Coghlan
Antoine Pitrou wrote: > M.-A. Lemburg egenix.com> writes: >> Please file a bug report for this. f.readlines() (or rather >> the io layer) should be using Py_UNICODE_ISLINEBREAK(ch) >> for detecting line break characters. > > Actually, no. It has been designed from the start to only recognize the

Re: [Python-Dev] PEP 385: the eol-type issue

2009-08-06 Thread Antoine Pitrou
M.-A. Lemburg egenix.com> writes: > > Please file a bug report for this. f.readlines() (or rather > the io layer) should be using Py_UNICODE_ISLINEBREAK(ch) > for detecting line break characters. Actually, no. It has been designed from the start to only recognize the "standard" line break repres

Re: [Python-Dev] PEP 385: the eol-type issue

2009-08-06 Thread M.-A. Lemburg
Neil Hodgson wrote: > Glenn Linderman: > >> and perhaps other things (and >> are there new Unicode control characters that could be used for line >> endings?), > >Unicode includes Line Separator U+2028 and Paragraph Separator > U+2029 but they are rarely supported and very rarely used. They a

Re: [Python-Dev] PEP 385: the eol-type issue

2009-08-06 Thread Stephen J. Turnbull
"Martin v. Löwis" writes: > > This is simply false AFAICS. There was little participation on this > > particular issue during PEP 374 that I can recall. Now that it is > > clearly an issue after all, it's still early in the PEP 385 process. > > Martin has already picked up the ball on EOL sup