Re: [Python-Dev] Questions/comments on documentation formatting

2009-01-19 Thread Raymond Hettinger
In particular, look at the urls for: http://docs.python.org/dev/library/collections.html#id1 versus http://docs.python.org/dev/library/collections.html#abcs-abstract-base-classes I would like all of the targets to have meaningful names. [Brett] Not sure from a sphinx perspective, but Docutil

Re: [Python-Dev] Questions/comments on documentation formatting

2009-01-19 Thread Brett Cannon
On Mon, Jan 19, 2009 at 19:02, Scott Dial wrote: > Brett Cannon wrote: >> 3. Are brackets for optional arguments (e.g. ``def fxn(a [, b=None [, >> c=None]])``) really necessary when default argument values are >> present? And do we really need to nest the brackets when it is obvious >> that having

Re: [Python-Dev] Questions/comments on documentation formatting

2009-01-19 Thread Brett Cannon
On Mon, Jan 19, 2009 at 19:50, Raymond Hettinger wrote: > I have another question about doc formatting. > > What controls whether section headers get urls with a custom named jump > target instead of a default name like "id1"? > > In particular, look at the urls for: > http://docs.python.org/dev

Re: [Python-Dev] Questions/comments on documentation formatting

2009-01-19 Thread Brett Cannon
On Mon, Jan 19, 2009 at 19:19, Benjamin Peterson wrote: > On Mon, Jan 19, 2009 at 9:11 PM, Brett Cannon wrote: >> On Mon, Jan 19, 2009 at 19:01, Benjamin Peterson wrote: >>> On Mon, Jan 19, 2009 at 8:24 PM, Brett Cannon wrote: 2. Should we start using function annotations? >>> >>> No,

Re: [Python-Dev] Questions/comments on documentation formatting

2009-01-19 Thread Ben Finney
"Raymond Hettinger" writes: > What controls whether section headers get urls with a custom named > jump target instead of a default name like "id1"? > > In particular, look at the urls for: >http://docs.python.org/dev/library/collections.html#id1 versus Hmm. Immediately preceding the eleme

Re: [Python-Dev] Questions/comments on documentation formatting

2009-01-19 Thread Raymond Hettinger
I have another question about doc formatting. What controls whether section headers get urls with a custom named jump target instead of a default name like "id1"? In particular, look at the urls for: http://docs.python.org/dev/library/collections.html#id1 versus http://docs.python.org/de

Re: [Python-Dev] Questions/comments on documentation formatting

2009-01-19 Thread Ben Finney
"Benjamin Peterson" writes: > On Mon, Jan 19, 2009 at 9:23 PM, Raymond Hettinger wrote: > > From: "Brett Cannon" > >> > >> 1. Why is three space indents the preferred indentation level? > > > > I've also wondered about this. It is somewhat incovenient > > when bringing in code samples from fil

Re: [Python-Dev] Questions/comments on documentation formatting

2009-01-19 Thread Benjamin Peterson
On Mon, Jan 19, 2009 at 9:23 PM, Raymond Hettinger wrote: > From: "Brett Cannon" >> >> 1. Why is three space indents the preferred indentation level? > > I've also wondered about this. It is somewhat incovenient > when bringing in code samples from files with four space indents. It's just reST

Re: [Python-Dev] Questions/comments on documentation formatting

2009-01-19 Thread Raymond Hettinger
From: "Brett Cannon" 1. Why is three space indents the preferred indentation level? I've also wondered about this. It is somewhat incovenient when bringing in code samples from files with four space indents. Raymond ___ Python-Dev mailing list Py

Re: [Python-Dev] Questions/comments on documentation formatting

2009-01-19 Thread Benjamin Peterson
On Mon, Jan 19, 2009 at 9:11 PM, Brett Cannon wrote: > On Mon, Jan 19, 2009 at 19:01, Benjamin Peterson wrote: >> On Mon, Jan 19, 2009 at 8:24 PM, Brett Cannon wrote: >>> >>> 2. Should we start using function annotations? >> >> No, I think that information is better stored in the function descri

Re: [Python-Dev] Questions/comments on documentation formatting

2009-01-19 Thread Brett Cannon
On Mon, Jan 19, 2009 at 19:01, Benjamin Peterson wrote: > On Mon, Jan 19, 2009 at 8:24 PM, Brett Cannon wrote: >> I have been writing up the initial docs for importlib and four things struck >> me: >> >> 1. Why is three space indents the preferred indentation level? > > Because it matches nicely

Re: [Python-Dev] Questions/comments on documentation formatting

2009-01-19 Thread Scott Dial
Brett Cannon wrote: > 3. Are brackets for optional arguments (e.g. ``def fxn(a [, b=None [, > c=None]])``) really necessary when default argument values are > present? And do we really need to nest the brackets when it is obvious > that having on optional argument means the rest are optional as wel

Re: [Python-Dev] Questions/comments on documentation formatting

2009-01-19 Thread Benjamin Peterson
On Mon, Jan 19, 2009 at 8:24 PM, Brett Cannon wrote: > I have been writing up the initial docs for importlib and four things struck > me: > > 1. Why is three space indents the preferred indentation level? Because it matches nicely up with the length of directives: .. somedirective:: blah ^^^ >

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Cameron Simpson
On 19Jan2009 19:42, Calvin Spealman wrote: | OK, I still don't like the general idea, but I have a suggestion for | what I think is a more favorable syntax, anyway. Basically, adding the | allowance of an 'else break' when there is an if clause in a generator | expression or list comprehension. I

[Python-Dev] Copyright notices in modules

2009-01-19 Thread Stephen J. Turnbull
Raymond Hettinger writes: > Does the copyright concept even apply to an abstract base class (I > thought APIs were not subject to copyright, just like database > layouts and language definitions)? Yes, it does, although a public API per se is not subject to copyright, because there's only one

[Python-Dev] Questions/comments on documentation formatting

2009-01-19 Thread Brett Cannon
I have been writing up the initial docs for importlib and four things struck me: 1. Why is three space indents the preferred indentation level? 2. Should we start using function annotations? 3. Are brackets for optional arguments (e.g. ``def fxn(a [, b=None [, c=None]])``) really necessary when

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Calvin Spealman
OK, I still don't like the general idea, but I have a suggestion for what I think is a more favorable syntax, anyway. Basically, adding the allowance of an 'else break' when there is an if clause in a generator expression or list comprehension. I still dont think it should be done, but it is a more

[Python-Dev] Copyright notices in modules

2009-01-19 Thread Raymond Hettinger
Why does numbers.py say: # Copyright 2007 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. Weren't there multiple contributors including non-google people? Does Google want to be associated with code that was submitted with no tests? Do we want this sort

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Terry Reedy
Kristján Valur Jónsson wrote: Are you all certain that this mapping from a generator expression to a foor loop isn't just a happy coincidence? Yes, The manual *defines* the meaning of a comprehension in terms of the corresponding nested statements. "The comprehension consists of a single exp

Re: [Python-Dev] Add a "while" clause to generator expressions

2009-01-19 Thread
The proposal is similar to the c do statement do statement while (expression); which for whatever reason (infrequency?) like the switch statement have rightly not been adopted into python. <>___ Python-Dev mailing list Python-Dev@python.org http://mail

Re: [Python-Dev] Hmmm... __PyObject_NextNotImplemented when tracing lines

2009-01-19 Thread skip
Alexander> I cannot reproduce this on my Mac. It looks like you may Alexander> have an out of date python.exe in your sandbox. Please check Alexander> that Alexander> $ nm python.exe | grep PyObject_NextNotImplemented Alexander> 00052940 T __PyObject_NextNotImplemented

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Kristján Valur Jónsson
Are you all certain that this mapping from a generator expression to a foor loop isn't just a happy coincidence? After all, the generator statement is just a generalization of the list comprehension and that doesn't map quite so directly. I have always taken both expressions at face value, and n

[Python-Dev] compiling python2.5 (msys+mingw+wine) using msvcr80 assemblies

2009-01-19 Thread Luke Kenneth Casson Leighton
folks, hi, after some quiet advice i've tracked down a method for compiling python2.5 using msvcr80 that _will_ actually work both under native win32 and also under wine, but it's a _bit_ dodgy, as i couldn't track down where you're supposed to put Microsoft.VC80.CRT, except in the path of the appl

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Nick Coghlan
Steven Bethard wrote: > -1. As I pointed out on python-ideas, this proposal makes "while" mean > something different in a generator expression. While I initially found the suggestion in the PEP rather cute, that isn't enough to make it a good idea as a language addition. So, -1 for a few reasons:

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Sturla Molden
On 1/19/2009 6:51 PM, Terry Reedy wrote: The other, posted by Steven Bethard, is that it fundamentally breaks the current semantics of abbreviating (except for iteration variable scoping) an 'equivalent' for loop. The proposed syntax would suggest that this should be legal as well: for i in

Re: [Python-Dev] stuck with dlopen...

2009-01-19 Thread Gregory P. Smith
If you run your python.exe under gdb you should be able to set a future breakpoint on your _PyEval_EvalMiniFrameEx function and debug from there. On Wed, Jan 14, 2009 at 8:28 PM, wrote: > > I've recently been working on generating C functions on-the-fly which > inline > the C code necessary to i

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Brett Cannon
On Mon, Jan 19, 2009 at 10:03, Gerald Britton wrote: > Duly noted and thanks for the feedback! (just what I was looking for > actually). I do disagree with the idea that the proposal, if > implemented, would make Python harder to learn. Not sure who would > find it harder. Having to find and u

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Paul Moore
2009/1/19 Vitor Bosshard : > Are you even sure the list comprehension doesn't already shortcut evaluation? > > This quick test in 2.6 hints otherwise: > > a = (i for i in range(10) if i**2<10) Yes, but your test, once it becomes true, remains so. Consider >>> list(n for n in range(10) if n%2

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Alexander Belopolsky
On Mon, Jan 19, 2009 at 1:41 PM, Scott Dial wrote: > Vitor Bosshard wrote: >> Are you even sure the list comprehension doesn't already shortcut evaluation? > > It does not. The body of the comprehension is evaluated all the way to > completion, .. In addition, the test is evaluated on all items a

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Gustavo Carneiro
2009/1/19 Vitor Bosshard > > > > > - Mensaje original > > De: Gerald Britton > > Para: Terry Reedy > > CC: python-dev@python.org > > Enviado: lunes, 19 de enero, 2009 15:03:47 > > Asunto: Re: [Python-Dev] PEP 3142: Add a "while" clause to generator > expressions > > > > Duly noted and

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Scott Dial
Vitor Bosshard wrote: > Are you even sure the list comprehension doesn't already shortcut evaluation? It does not. The body of the comprehension is evaluated all the way to completion, despite the fact that a.next() does not return until there is a successful test of the if expression. >>> def pr

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Vitor Bosshard
- Mensaje original > De: Gerald Britton > Para: Terry Reedy > CC: python-dev@python.org > Enviado: lunes, 19 de enero, 2009 15:03:47 > Asunto: Re: [Python-Dev] PEP 3142: Add a "while" clause to generator > expressions > > Duly noted and thanks for the feedback!  (just what I was lo

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Gerald Britton
Duly noted and thanks for the feedback! (just what I was looking for actually). I do disagree with the idea that the proposal, if implemented, would make Python harder to learn. Not sure who would find it harder. Having to find and use takewhile was harder for me. I still find that one counter-

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Terry Reedy
Gerald Britton wrote: Please find below PEP 3142: Add a "while" clause to generator expressions. I'm looking for feedback and discussion. This was already discussed on python-ideas where it got negative feedback. One objection, mentioned by Mathias Panzerbock and Georg Brandl, is that it is

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Steven Bethard
On Mon, Jan 19, 2009 at 7:10 AM, Gerald Britton wrote: > PEP: 3142 > Title: Add a "while" clause to generator expressions [snip] > numbers in that range. Allowing for a "while" clause would allow > the redundant tests to be short-circuited: > > g = (n for n in range(100) while n*n < 50) >

Re: [Python-Dev] Hmmm... __PyObject_NextNotImplemented when tracing lines

2009-01-19 Thread Alexander Belopolsky
On Mon, Jan 19, 2009 at 11:51 AM, wrote: > I see output like this in several tests on my Mac: > >test_array skipped -- > dlopen(/Users/skip/src/python/trunk/build/lib.macosx-10.3-i386-2.7/cPickle.so, > 2): Symbol not found: __PyObject_NextNotImplemented > Referenced from: > /Users/ski

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Calvin Spealman
On Mon, Jan 19, 2009 at 11:41 AM, Gerald Britton wrote: > Thanks Calvin, > > Could you please expand on your thoughts about possible confusion? > That is, how do you see a programmer becoming confused if this option > were added to the syntax. I think that the difference between these two lines i

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Gerald Britton
The sieve is just one example. The basic idea is that for some infinite generator (even a very simple one) you want to cut it off after some point. As for the number of characters, I spelled lambda incorrectly (left out a b) and there should be a space after the colon to conform to design guides.

[Python-Dev] Hmmm... __PyObject_NextNotImplemented when tracing lines

2009-01-19 Thread skip
I see output like this in several tests on my Mac: test_array skipped -- dlopen(/Users/skip/src/python/trunk/build/lib.macosx-10.3-i386-2.7/cPickle.so, 2): Symbol not found: __PyObject_NextNotImplemented Referenced from: /Users/skip/src/python/trunk/build/lib.macosx-10.3-i386-2.7/cPic

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Daniel Stutzbach
On Mon, Jan 19, 2009 at 10:37 AM, Gerald Britton wrote: >prime = (p for p in sieve() while p < 1000) >prime = takewhile(lamda p:p<1000, sieve()) > I'm pretty sure the extra cost of evaluating the lambda at each step is tiny compared to the cost of the sieve, so I don't you can make a conv

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Facundo Batista
2009/1/19 Gerald Britton : > Could you please expand on your thoughts about possible confusion? > That is, how do you see a programmer becoming confused if this option > were added to the syntax. My main concern about confusion is that you're adding a "while" that actually will behave like a "bre

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Gerald Britton
Thanks Calvin, Could you please expand on your thoughts about possible confusion? That is, how do you see a programmer becoming confused if this option were added to the syntax. On Mon, Jan 19, 2009 at 11:29 AM, Calvin Spealman wrote: > I am really unconvinced of the utility of this proposal and

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Gerald Britton
Sure: Say I implement the sieve of Eratosthenes as a prime number generator. I want some primes for my application but there are an infinite number of primes. So I would like to write: prime = (p for p in sieve() while p < 1000) instead of: import itertools prime = takewhile(lamda

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Calvin Spealman
I am really unconvinced of the utility of this proposal and quite convinced of the confusing factor it may well add to the current syntax. I would like to see more applicable examples. It would replace uses of takewhile, but that isn't a really often used function. So, is there any evidence to supp

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Daniel Stutzbach
On Mon, Jan 19, 2009 at 9:10 AM, Gerald Britton wrote: > g = (n for n in range(100) if n*n < 50) > > would yield 0, 1, 2, 3, 4, 5, 6 and 7, but would also consider > the numbers from 8 to 99 and reject them all since n*n >= 50 for > numbers in that range. Allowing for a "while" clause wou

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Benjamin Peterson
On Mon, Jan 19, 2009 at 9:10 AM, Gerald Britton wrote: > Please find below PEP 3142: Add a "while" clause to generator > expressions. I'm looking for feedback and discussion. > > > PEP: 3142 > Title: Add a "while" clause to generator expressions > Version: $Revision: 68715 $ > Last-Modified: $Dat

[Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Gerald Britton
Please find below PEP 3142: Add a "while" clause to generator expressions. I'm looking for feedback and discussion. PEP: 3142 Title: Add a "while" clause to generator expressions Version: $Revision: 68715 $ Last-Modified: $Date: 2009-01-18 11:28:20 +0100 (So, 18. Jan 2009) $ Author: Gerald Britt

Re: [Python-Dev] Child process freezes during fork pipe exec

2009-01-19 Thread Nick Coghlan
Gangadharan S.A. wrote: > Hi, > > Summary: > * In my organization, we have a *multi threaded* (threading library) > python (python 2.4.1) daemon on Linux, which starts up various processes > using the fork pipe exec model. The fork+threading combination had some fairly major issues that weren

[Python-Dev] Child process freezes during fork pipe exec

2009-01-19 Thread Gangadharan S.A.
Hi, Summary: * In my organization, we have a *multi threaded* (threading library) python (python 2.4.1) daemon on Linux, which starts up various processes using the fork pipe exec model. * We use this fork , wait on pipe , exec model as a form of handshake between the parent and child pr

Re: [Python-Dev] Support for the Haiku OS

2009-01-19 Thread Mark Dickinson
On Sun, Jan 18, 2009 at 11:03 PM, scott mc wrote: > I built 2.7 on Haiku, but am getting failures in the regression tests. > Many of them are in math related tests, failing in the 15th decimal > place on test_decimal and a few others like that, I posted a ticket on > Haiku's trac for that as it m