Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Raymond Hettinger
On May 14, 2013, at 9:39 AM, Gregory P. Smith g...@krypto.org wrote: Bad: doctests. I'm hoping that core developers don't get caught-up in the doctests are bad meme. Instead, we should be clear about their primary purpose which is to test the examples given in docstrings. In many cases,

Re: [Python-Dev] HAVE_FSTAT?

2013-05-19 Thread Charles-François Natali
2013/5/17 Antoine Pitrou solip...@pitrou.net: Hello, Some pieces of code are still guarded by: #ifdef HAVE_FSTAT ... #endif I would expect all systems to have fstat() these days. It's pretty basic POSIX, and even Windows has had it for ages. Shouldn't we simply make those code blocks

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Nick Coghlan
On Sun, May 19, 2013 at 4:41 PM, Raymond Hettinger raymond.hettin...@gmail.com wrote: nicer repr is worth Sorry, I broke your tests, made your published examples out of date, and slowed down your code. While the first two considerations are always potentially applicable when using enums, the

Re: [Python-Dev] HAVE_FSTAT?

2013-05-19 Thread Antoine Pitrou
On Sun, 19 May 2013 10:08:39 +0200 Charles-François Natali cf.nat...@gmail.com wrote: 2013/5/17 Antoine Pitrou solip...@pitrou.net: Hello, Some pieces of code are still guarded by: #ifdef HAVE_FSTAT ... #endif I would expect all systems to have fstat() these days. It's pretty

Re: [Python-Dev] Ordering keyword dicts

2013-05-19 Thread Skip Montanaro
On Sat, May 18, 2013 at 10:27 PM, Raymond Hettinger raymond.hettin...@gmail.com wrote: BTW, I'm +1 on the idea for ordering keyword-args. It makes it easier to debug if the arguments show-up in the order they were created. AFAICT, no purpose is served by scrambling them (which is

Re: [Python-Dev] Ordering keyword dicts

2013-05-19 Thread Antoine Pitrou
On Sat, 18 May 2013 22:47:35 -0700 Guido van Rossum gu...@python.org wrote: On Sat, May 18, 2013 at 10:27 PM, Raymond Hettinger raymond.hettin...@gmail.com wrote: BTW, I'm +1 on the idea for ordering keyword-args. It makes it easier to debug if the arguments show-up in the order they were

Re: [Python-Dev] More compact dictionaries with faster iteration

2013-05-19 Thread Maciej Fijalkowski
On Sun, May 19, 2013 at 7:27 AM, Raymond Hettinger raymond.hettin...@gmail.com wrote: On May 15, 2013, at 4:32 AM, Christian Tismer tis...@stackless.com wrote: What is the current status of this discussion? I'd like to know whether it is a considered alternative implementation. As far as I

Re: [Python-Dev] Ordering keyword dicts

2013-05-19 Thread Nick Coghlan
On Sun, May 19, 2013 at 11:01 PM, Antoine Pitrou solip...@pitrou.net wrote: The main use case seems to be the OrderedDict constructor itself. Otherwise, I can't think of any situation where I would've wanted it. I've had a couple related to populating other mappings where order matters, at

Re: [Python-Dev] HAVE_FSTAT?

2013-05-19 Thread Guido van Rossum
Fake values would probably cause hard to debug problems. It's a long standing Python tradition not to offer low level APIs that the platform doesn't have. — Sent from Mailbox On Sun, May 19, 2013 at 5:20 AM, Antoine Pitrou solip...@pitrou.net wrote: On Sun, 19 May 2013 10:08:39 +0200

Re: [Python-Dev] HAVE_FSTAT?

2013-05-19 Thread Antoine Pitrou
On Sun, 19 May 2013 07:47:14 -0700 (PDT) Guido van Rossum gvanros...@gmail.com wrote: Fake values would probably cause hard to debug problems. It's a long standing Python tradition not to offer low level APIs that the platform doesn't have. I meant the platform, not Python. Regards Antoine.

Re: [Python-Dev] Ordering keyword dicts

2013-05-19 Thread Guido van Rossum
Hm. Wouldn'tvevery call site be slowed down by checking for that flag? — Sent from Mailbox On Sun, May 19, 2013 at 7:42 AM, Nick Coghlan ncogh...@gmail.com wrote: On Sun, May 19, 2013 at 11:01 PM, Antoine Pitrou solip...@pitrou.net wrote: The main use case seems to be the OrderedDict

Re: [Python-Dev] Ordering keyword dicts

2013-05-19 Thread Maciej Fijalkowski
On Sun, May 19, 2013 at 4:40 PM, Nick Coghlan ncogh...@gmail.com wrote: On Sun, May 19, 2013 at 11:01 PM, Antoine Pitrou solip...@pitrou.net wrote: The main use case seems to be the OrderedDict constructor itself. Otherwise, I can't think of any situation where I would've wanted it. I've had

Re: [Python-Dev] HAVE_FSTAT?

2013-05-19 Thread Nick Coghlan
On Mon, May 20, 2013 at 12:51 AM, Antoine Pitrou solip...@pitrou.net wrote: On Sun, 19 May 2013 07:47:14 -0700 (PDT) Guido van Rossum gvanros...@gmail.com wrote: Fake values would probably cause hard to debug problems. It's a long standing Python tradition not to offer low level APIs that the

Re: [Python-Dev] Ordering keyword dicts

2013-05-19 Thread Joao S. O. Bueno
On 19 May 2013 11:57, Guido van Rossum gvanros...@gmail.com wrote: Hm. Wouldn'tvevery call site be slowed down by checking for that flag? Actually, when I was thinking on the subject I came to the same idea, of having some functions marked differently so they would use a different call mechanism

Re: [Python-Dev] HAVE_FSTAT?

2013-05-19 Thread Antoine Pitrou
On Mon, 20 May 2013 01:09:19 +1000 Nick Coghlan ncogh...@gmail.com wrote: On Mon, May 20, 2013 at 12:51 AM, Antoine Pitrou solip...@pitrou.net wrote: On Sun, 19 May 2013 07:47:14 -0700 (PDT) Guido van Rossum gvanros...@gmail.com wrote: Fake values would probably cause hard to debug

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Guido van Rossum
Anyway, if you're doing arithmetic on enums you're doing it wrong.  — Sent from Mailbox On Sun, May 19, 2013 at 4:55 AM, Nick Coghlan ncogh...@gmail.com wrote: On Sun, May 19, 2013 at 4:41 PM, Raymond Hettinger raymond.hettin...@gmail.com wrote: nicer repr is worth Sorry, I broke your tests,

[Python-Dev] Async subprocesses on Windows with tulip

2013-05-19 Thread Richard Oudkerk
Attached is a pretty trivial example of asynchronous interaction with a python subprocess using tulip on Windows. It does not use transports or protocols -- instead sock_recv() and sock_sendall() are used inside tasks. I am not sure what the plan is for dealing with subprocesses currently.

Re: [Python-Dev] Async subprocesses on Windows with tulip

2013-05-19 Thread Benjamin Peterson
Shouldn't this go to the python-tulip list? 2013/5/19 Richard Oudkerk shibt...@gmail.com: Attached is a pretty trivial example of asynchronous interaction with a python subprocess using tulip on Windows. It does not use transports or protocols -- instead sock_recv() and sock_sendall() are

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Dan Stromberg
On Sat, May 18, 2013 at 11:41 PM, Raymond Hettinger raymond.hettin...@gmail.com wrote: On May 14, 2013, at 9:39 AM, Gregory P. Smith g...@krypto.org wrote: Bad: doctests. I'm hoping that core developers don't get caught-up in the doctests are bad meme. Don't doctests intended for

Re: [Python-Dev] Async subprocesses on Windows with tulip

2013-05-19 Thread Richard Oudkerk
On 19/05/2013 5:03pm, Benjamin Peterson wrote: Shouldn't this go to the python-tulip list? Yes. Sorry about that. -- Richard ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/19/2013 10:48 AM, Guido van Rossum wrote: Anyway, if you're doing arithmetic on enums you're doing it wrong. Hmm, bitwise operations, even? Tres. - -- === Tres Seaver

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/19/2013 12:14 PM, Dan Stromberg wrote: On Sat, May 18, 2013 at 11:41 PM, Raymond Hettinger raymond.hettin...@gmail.com wrote: On May 14, 2013, at 9:39 AM, Gregory P. Smith g...@krypto.org wrote: Bad: doctests. I'm hoping that

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Terry Jan Reedy
On 5/19/2013 4:13 PM, Tres Seaver wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/19/2013 10:48 AM, Guido van Rossum wrote: Anyway, if you're doing arithmetic on enums you're doing it wrong. Hmm, bitwise operations, even? Those are logic, not arithmetic as usually understood.

[Python-Dev] Why is documentation not inline?

2013-05-19 Thread Demian Brecht
This is more out of curiosity than to spark change (although I wouldn't argue against it): Does anyone know why it was decided to document external to source files rather than inline? When rapidly digging through source, it would be much more helpful to see parameter docs than to either have to

Re: [Python-Dev] Why is documentation not inline?

2013-05-19 Thread Antoine Pitrou
On Sun, 19 May 2013 15:29:37 -0700 Demian Brecht demianbre...@gmail.com wrote: This is more out of curiosity than to spark change (although I wouldn't argue against it): Does anyone know why it was decided to document external to source files rather than inline? When rapidly digging through

Re: [Python-Dev] Why is documentation not inline?

2013-05-19 Thread Benjamin Peterson
2013/5/19 Demian Brecht demianbre...@gmail.com: This is more out of curiosity than to spark change (although I wouldn't argue against it): Does anyone know why it was decided to document external to source files rather than inline? When rapidly digging through source, it would be much more

Re: [Python-Dev] Ordering keyword dicts

2013-05-19 Thread Nick Coghlan
On 20 May 2013 00:57, Guido van Rossum gvanros...@gmail.com wrote: Hm. Wouldn'tvevery call site be slowed down by checking for that flag? Yeah, I forgot about having to push everything through the tp_call slot, so we can't easily limit the ordering check to just those cases where the callable

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Nick Coghlan
On 20 May 2013 06:25, Terry Jan Reedy tjre...@udel.edu wrote: On 5/19/2013 4:13 PM, Tres Seaver wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/19/2013 10:48 AM, Guido van Rossum wrote: Anyway, if you're doing arithmetic on enums you're doing it wrong. Hmm, bitwise

Re: [Python-Dev] Why is documentation not inline?

2013-05-19 Thread Demian Brecht
@benjamin: Ah, i see. I wasn't around pre-Sphinx. However, unless there's some custom build steps that I'm unaware of that may prevent it, it should still be relatively easy to maintain the desired narrative structure as long as the inline API docs are kept terse. @antoine: Sorry, I may not have

Re: [Python-Dev] [RELEASED] Python 2.7.5

2013-05-19 Thread Pierre Rouleau
Hi all, I just installed Python 2.7.5 64-bit () on a Windows 7 64-bit OS computer. When I evaluate sys.maxint I don't get what I was expected. I get this: Python 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)] on win32 Type copyright, credits or license() for more

Re: [Python-Dev] [RELEASED] Python 2.7.5

2013-05-19 Thread Benjamin Peterson
2013/5/19 Pierre Rouleau prouleau...@gmail.com: Hi all, I just installed Python 2.7.5 64-bit () on a Windows 7 64-bit OS computer. When I evaluate sys.maxint I don't get what I was expected. I get this: Python 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)] on win32

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Mark Janssen
On Sun, May 19, 2013 at 1:13 PM, Tres Seaver tsea...@palladion.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/19/2013 10:48 AM, Guido van Rossum wrote: Anyway, if you're doing arithmetic on enums you're doing it wrong. Hmm, bitwise operations, even? I think it's rather

Re: [Python-Dev] [RELEASED] Python 2.7.5

2013-05-19 Thread Pierre Rouleau
OK thanks, Benjamin, you are correct sys.maxsize is 2*63-1 on it. I was under the impression that Python was using int_64_t for the implementation of Win64 based integers. Most probably because I've sen discussion on Python 64 bits and those post were most probably were in the scope of some

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Gregory P. Smith
On Sat, May 18, 2013 at 11:41 PM, Raymond Hettinger raymond.hettin...@gmail.com wrote: On May 14, 2013, at 9:39 AM, Gregory P. Smith g...@krypto.org wrote: Bad: doctests. I'm hoping that core developers don't get caught-up in the doctests are bad meme. So long as doctests insist on

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Benjamin Peterson
2013/5/19 Gregory P. Smith g...@krypto.org: Idea: I don't believe anybody has written a fixer for lib2to3 that applies fixers to doctests. That'd be an interesting project for someone. 2to3 can operate on doctests, though it doesn't do anything different to them than it does to normal

Re: [Python-Dev] [RELEASED] Python 2.7.5

2013-05-19 Thread Pierre Rouleau
On that topic of bitness for 64-bit platforms, would it not be better for CPython to be written such that it uses the same 64-bit strategy on all 64-bit platforms, regardless of the OS? As it is now, Python running on 64-bit Windows behaves differently (in terms of bits for the Python's integer)

Re: [Python-Dev] [RELEASED] Python 2.7.5

2013-05-19 Thread Antoine Pitrou
On Sun, 19 May 2013 19:37:46 -0400 Pierre Rouleau prouleau...@gmail.com wrote: On that topic of bitness for 64-bit platforms, would it not be better for CPython to be written such that it uses the same 64-bit strategy on all 64-bit platforms, regardless of the OS? As it is now, Python

Re: [Python-Dev] [RELEASED] Python 2.7.5

2013-05-19 Thread Pierre Rouleau
On Sun, May 19, 2013 at 7:41 PM, Antoine Pitrou solip...@pitrou.net wrote: On Sun, 19 May 2013 19:37:46 -0400 Pierre Rouleau prouleau...@gmail.com wrote: On that topic of bitness for 64-bit platforms, would it not be better for CPython to be written such that it uses the same 64-bit

Re: [Python-Dev] Why is documentation not inline?

2013-05-19 Thread Nick Coghlan
On 20 May 2013 08:51, Demian Brecht demianbre...@gmail.com wrote: @benjamin: Ah, i see. I wasn't around pre-Sphinx. However, unless there's some custom build steps that I'm unaware of that may prevent it, it should still be relatively easy to maintain the desired narrative structure as long

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Gregory P. Smith
On May 19, 2013 4:31 PM, Benjamin Peterson benja...@python.org wrote: 2013/5/19 Gregory P. Smith g...@krypto.org: Idea: I don't believe anybody has written a fixer for lib2to3 that applies fixers to doctests. That'd be an interesting project for someone. 2to3 can operate on doctests,

Re: [Python-Dev] [RELEASED] Python 2.7.5

2013-05-19 Thread Richard Oudkerk
On 20/05/2013 12:47am, Pierre Rouleau wrote: Moreover, the development version is 3.4, and in Python 3 the int type is a variable-length integer type (sys.maxint doesn't exist anymore). So this discussion is largely moot now. Good to know. Too bad there still are libraries not

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Ned Batchelder
On 5/19/2013 7:22 PM, Mark Janssen wrote: On Sun, May 19, 2013 at 1:13 PM, Tres Seaver tsea...@palladion.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/19/2013 10:48 AM, Guido van Rossum wrote: Anyway, if you're doing arithmetic on enums you're doing it wrong. Hmm, bitwise

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Antoine Pitrou
On Sun, 19 May 2013 20:04:03 -0400 Ned Batchelder n...@nedbatchelder.com wrote: On 5/19/2013 7:22 PM, Mark Janssen wrote: On Sun, May 19, 2013 at 1:13 PM, Tres Seaver tsea...@palladion.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/19/2013 10:48 AM, Guido van Rossum

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Nick Coghlan
On Mon, May 20, 2013 at 10:14 AM, Antoine Pitrou solip...@pitrou.net wrote: On Sun, 19 May 2013 20:04:03 -0400 Ned Batchelder n...@nedbatchelder.com wrote: On 5/19/2013 7:22 PM, Mark Janssen wrote: On Sun, May 19, 2013 at 1:13 PM, Tres Seaver tsea...@palladion.com wrote: -BEGIN PGP

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Tim Peters
[Raymond Hettinger] I'm hoping that core developers don't get caught-up in the doctests are bad meme. Instead, we should be clear about their primary purpose which is to test the examples given in docstrings. I disagree. In many cases, there is a great deal of benefit to docstrings that

Re: [Python-Dev] Why is documentation not inline?

2013-05-19 Thread Demian Brecht
@nick: Yes, I realize what docstrings are for (I should have used that term rather than inline docs, my bad there :)). I think the problem that I've run into is simply inconsistencies in methods of documenting code (and the few times that it would have been helpful, what I was looking at had not

Re: [Python-Dev] Ordering keyword dicts

2013-05-19 Thread Greg Ewing
Joao S. O. Bueno wrote: Actually, when I was thinking on the subject I came to the same idea, of having some functions marked differently so they would use a different call mechanism - but them I wondered around having a different opcode for the ordered-dict calls. Would that be feasible? No,

[Python-Dev] What if we didn't have repr?

2013-05-19 Thread Guido van Rossum
On Sun, May 19, 2013 at 4:27 PM, Gregory P. Smith g...@krypto.org wrote: Now you've got me wondering what Python would be like if repr, `` and __repr__ never existed as language features. Upon first thoughts, I actually don't see much downside (no, i'm not advocating making that change).

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Steven D'Aprano
On 20/05/13 09:27, Gregory P. Smith wrote: On Sat, May 18, 2013 at 11:41 PM, Raymond Hettinger raymond.hettin...@gmail.com wrote: On May 14, 2013, at 9:39 AM, Gregory P. Smith g...@krypto.org wrote: Bad: doctests. I'm hoping that core developers don't get caught-up in the doctests are bad

Re: [Python-Dev] Why is documentation not inline?

2013-05-19 Thread Nick Coghlan
On Mon, May 20, 2013 at 11:19 AM, Demian Brecht demianbre...@gmail.com wrote: @nick: Yes, I realize what docstrings are for (I should have used that term rather than inline docs, my bad there :)). I think the problem that I've run into is simply inconsistencies in methods of documenting code

Re: [Python-Dev] What if we didn't have repr?

2013-05-19 Thread Nick Coghlan
On Mon, May 20, 2013 at 11:46 AM, Guido van Rossum gu...@python.org wrote: On Sun, May 19, 2013 at 4:27 PM, Gregory P. Smith g...@krypto.org wrote: Now you've got me wondering what Python would be like if repr, `` and __repr__ never existed as language features. Upon first thoughts, I actually

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Stephen J. Turnbull
Gregory P. Smith writes: I really do applaud the goal of keeping examples in documentation up to date. But doctest as it is today is the wrong approach to that. A repr mismatch does not mean the example is out of date. Of course it does. The user sees something in the doc that's

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Ethan Furman
On 05/19/2013 05:24 PM, Nick Coghlan wrote: This is the point I was trying to make: once you use IntEnum (as you would in any case where you need bitwise operators), Enum gets out of the way for everything other than __str__, __repr__, and one other slot (that escapes me for the moment...).