Re: [Python-Dev] test_itertools fails for trunk on x86 OS X machine

2006-09-22 Thread Tim Peters
[Neal Norwitz] It looks like %zd of a negative number is treated as an unsigned number on OS X, even though the man page says it should be signed. The z modifier, when applied to a d or i conversion, indicates that the argument is of a signed type equivalent in size to a size_t. It's not

Re: [Python-Dev] test_itertools fails for trunk on x86 OS X machine

2006-09-22 Thread Neal Norwitz
On 9/21/06, Tim Peters [EMAIL PROTECTED] wrote: Well, to be strictly anal, while the result of (size_t)-123 is defined, the result of casting /that/ back to a signed type of the same width is not defined. Maybe your compiler was doing you a favor ;-) I also tried with a cast to an

Re: [Python-Dev] New relative import issue

2006-09-22 Thread Josiah Carlson
Phillip J. Eby [EMAIL PROTECTED] wrote: At 08:44 PM 9/21/2006 -0700, Josiah Carlson wrote: This can be implemented with a fairly simple package registry, contained within a (small) SQLite database (which is conveniently shipped in Python 2.5). There can be a system-wide database that all

Re: [Python-Dev] list.discard? (Re: dict.discard)

2006-09-22 Thread Fredrik Lundh
Greg Ewing wrote: Actually I'd like this for lists. Often I find myself writing if x not in somelist: somelist.remove(x) A single method for doing this would be handy, and more efficient. there is a single method that does this, of course, but you have to sprinkle some sugar on it:

Re: [Python-Dev] test_itertools fails for trunk on x86 OS X machine

2006-09-22 Thread Ronald Oussoren
On Friday, September 22, 2006, at 08:38AM, Neal Norwitz [EMAIL PROTECTED] wrote: On 9/21/06, Tim Peters [EMAIL PROTECTED] wrote: Well, to be strictly anal, while the result of (size_t)-123 is defined, the result of casting /that/ back to a signed type of the same width is not

Re: [Python-Dev] New relative import issue

2006-09-22 Thread Nick Coghlan
Brett Cannon wrote: But either way I will be messing with the import system in the relatively near future. If you want to help, Paul (or anyone else), just send me an email and we can try to coordinate something (plan to do the work in the sandbox as a separate thing from my security

Re: [Python-Dev] [Python-checkins] release25-maint is UNFROZEN

2006-09-22 Thread Fred L. Drake, Jr.
On Thursday 21 September 2006 08:35, Armin Rigo wrote: Thanks for the hassle! I've got another bit of it for you, though. The freezed 2.5 documentation doesn't seem to be available on-line. At least, the doc links from the release page point to the 'dev' 2.6a0 version, and the URL

[Python-Dev] Python network Programmign

2006-09-22 Thread Raja Rokkam
Hi, I am currently doing my final year project Secure mobile Robot Management . I have done the theoretical aspects of it till now and now thinking of coding it .I would like to code in Python , but i am new to Python Network Programming . Some of features of my project are: 1. Each robot can

Re: [Python-Dev] Python network Programmign

2006-09-22 Thread Fredrik Lundh
Raja Rokkam wrote: I would like to code in Python , but i am new to Python Network Programming wrong list: python-dev is for people who develop the python core, not people who want to develop *in* python. see http://www.python.org/community/lists/ for a list of more appropriate forums.

Re: [Python-Dev] New relative import issue

2006-09-22 Thread Phillip J. Eby
At 12:08 AM 9/22/2006 -0700, Josiah Carlson wrote: Phillip J. Eby [EMAIL PROTECTED] wrote: At 08:44 PM 9/21/2006 -0700, Josiah Carlson wrote: This can be implemented with a fairly simple package registry, contained within a (small) SQLite database (which is conveniently shipped in Python

[Python-Dev] Suggestion for a new built-in - flatten

2006-09-22 Thread Michael Foord
Hello all, I have a suggestion for a new Python built in function: 'flatten'. This would (as if it needs explanation) take a single sequence, where each element can be a sequence (or iterable ?) nested to an arbitrary depth. It would return a flattened list. A useful restriction could be that

[Python-Dev] Relative import bug?

2006-09-22 Thread Thomas Heller
Consider a package containing these files: a/__init__.py a/b/__init__.py a/b/x.py a/b/y.py If x.py contains this: from ..b import y import a.b.x from ..b import x Python trunk and Python 2.5 both complain: Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32

Re: [Python-Dev] Relative import bug?

2006-09-22 Thread Phillip J. Eby
At 08:10 PM 9/22/2006 +0200, Thomas Heller wrote: Consider a package containing these files: a/__init__.py a/b/__init__.py a/b/x.py a/b/y.py If x.py contains this: from ..b import y import a.b.x from ..b import x Python trunk and Python 2.5 both complain: Python 2.5 (r25:51908, Sep 19 2006,

[Python-Dev] Pep 353: Py_ssize_t advice

2006-09-22 Thread David Abrahams
Pep 353 advises the use of this incantation: #if PY_VERSION_HEX 0x0205 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #endif I just wanted to point out that this advice could lead to library header collisions when multiple 3rd parties decide

Re: [Python-Dev] Suggestion for a new built-in - flatten

2006-09-22 Thread Josiah Carlson
Michael Foord [EMAIL PROTECTED] wrote: Hello all, I have a suggestion for a new Python built in function: 'flatten'. This has been brought up many times. I'm -1 on its inclusion, if only because it's a fairly simple 9-line function (at least the trivial version I came up with), and not

Re: [Python-Dev] Suggestion for a new built-in - flatten

2006-09-22 Thread Brett Cannon
On 9/22/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Michael There are several different possible approaches in pure Python,Michael but is this an idea that has legs ?Why not add it to itertools?Then, if you need a true list, just calllist() on the returned iterator. Yeah, this is a better

Re: [Python-Dev] Suggestion for a new built-in - flatten

2006-09-22 Thread Bob Ippolito
On 9/22/06, Josiah Carlson [EMAIL PROTECTED] wrote: Michael Foord [EMAIL PROTECTED] wrote: Hello all, I have a suggestion for a new Python built in function: 'flatten'. This has been brought up many times. I'm -1 on its inclusion, if only because it's a fairly simple 9-line function

Re: [Python-Dev] Suggestion for a new built-in - flatten

2006-09-22 Thread Brian Harring
On Fri, Sep 22, 2006 at 12:05:19PM -0700, Bob Ippolito wrote: On 9/22/06, Josiah Carlson [EMAIL PROTECTED] wrote: Michael Foord [EMAIL PROTECTED] wrote: Hello all, I have a suggestion for a new Python built in function: 'flatten'. This has been brought up many times. I'm -1

Re: [Python-Dev] Relative import bug?

2006-09-22 Thread Thomas Heller
Phillip J. Eby schrieb: At 08:10 PM 9/22/2006 +0200, Thomas Heller wrote: If x.py contains this: from ..b import y import a.b.x from ..b import x ... ImportError: cannot import name x A bug? If it is, it has nothing to do with relative importing per se. Note that changing it to from

Re: [Python-Dev] Suggestion for a new built-in - flatten

2006-09-22 Thread glyph
On Fri, 22 Sep 2006 18:43:42 +0100, Michael Foord [EMAIL PROTECTED] wrote: I have a suggestion for a new Python built in function: 'flatten'. This seems superficially like a good idea, but I think adding it to Python anywhere would do a lot more harm than good. I can see that consensus is

Re: [Python-Dev] New relative import issue

2006-09-22 Thread Josiah Carlson
Phillip J. Eby [EMAIL PROTECTED] wrote: At 12:08 AM 9/22/2006 -0700, Josiah Carlson wrote: Phillip J. Eby [EMAIL PROTECTED] wrote: At 08:44 PM 9/21/2006 -0700, Josiah Carlson wrote: [snip] You misunderstood me: I mean that the per-user database must be able to store information for

Re: [Python-Dev] Suggestion for a new built-in - flatten

2006-09-22 Thread Bob Ippolito
On 9/22/06, Brian Harring [EMAIL PROTECTED] wrote: On Fri, Sep 22, 2006 at 12:05:19PM -0700, Bob Ippolito wrote: On 9/22/06, Josiah Carlson [EMAIL PROTECTED] wrote: Michael Foord [EMAIL PROTECTED] wrote: Hello all, I have a suggestion for a new Python built in function:

Re: [Python-Dev] Suggestion for a new built-in - flatten

2006-09-22 Thread Michael Foord
[EMAIL PROTECTED] wrote: On Fri, 22 Sep 2006 18:43:42 +0100, Michael Foord [EMAIL PROTECTED] wrote: I have a suggestion for a new Python built in function: 'flatten'. This seems superficially like a good idea, but I think adding it to Python anywhere would do a lot more harm than

Re: [Python-Dev] Suggestion for a new built-in - flatten

2006-09-22 Thread Josiah Carlson
Bob Ippolito [EMAIL PROTECTED] wrote: On 9/22/06, Brian Harring [EMAIL PROTECTED] wrote: On Fri, Sep 22, 2006 at 12:05:19PM -0700, Bob Ippolito wrote: I think instead of adding a flatten function perhaps we should think about adding something like Erlang's iolist support. The idea is

Re: [Python-Dev] Pep 353: Py_ssize_t advice

2006-09-22 Thread Martin v. Löwis
David Abrahams schrieb: #if PY_VERSION_HEX 0x0205 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #endif I just wanted to point out that this advice could lead to library header collisions when multiple 3rd parties decide to follow it.

Re: [Python-Dev] Suggestion for a new built-in - flatten

2006-09-22 Thread Raymond Hettinger
[Michael Foord] I have a suggestion for a new Python built in function: 'flatten'. ... There are several different possible approaches in pure Python, but is this an idea that has legs ? No legs. It has been discussed ad naseum on comp.lang.python. People seem to enjoy writing their own

[Python-Dev] GCC patch for catching errors in PyArg_ParseTuple

2006-09-22 Thread Martin v. Löwis
I wrote a patch for the GCC trunk to add an __attribute__((format(PyArg_ParseTuple, 2, 3))) declaration to functions (this specific declaration should go to PyArg_ParseTuple only). With that patch, parameter types are compared with the string parameter (if that's a literal), and errors are

Re: [Python-Dev] New relative import issue

2006-09-22 Thread Phillip J. Eby
At 12:42 PM 9/22/2006 -0700, Josiah Carlson wrote: You might as well suggest that each environment consist of a single large zipfile containing the packages in question: this would actually be *more* practical (and fast!) in terms of Python startup, and is no different from having a

Re: [Python-Dev] Suggestion for a new built-in - flatten

2006-09-22 Thread Bob Ippolito
On 9/22/06, Josiah Carlson [EMAIL PROTECTED] wrote: Bob Ippolito [EMAIL PROTECTED] wrote: On 9/22/06, Brian Harring [EMAIL PROTECTED] wrote: On Fri, Sep 22, 2006 at 12:05:19PM -0700, Bob Ippolito wrote: I think instead of adding a flatten function perhaps we should think about

Re: [Python-Dev] Pep 353: Py_ssize_t advice

2006-09-22 Thread David Abrahams
Martin v. Löwis [EMAIL PROTECTED] writes: David Abrahams schrieb: #if PY_VERSION_HEX 0x0205 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #endif I just wanted to point out that this advice could lead to library header collisions

Re: [Python-Dev] GCC patch for catching errors in PyArg_ParseTuple

2006-09-22 Thread Giovanni Bajo
Martin v. Löwis wrote: I'll post more about this patch in the near future, and commit some bug fixes I found with it, but here is the patch, in a publish-early fashion. There is little chance that this can go into GCC (as it is too specific), so it likely needs to be maintained separately.

[Python-Dev] Typo.pl scan of Python 2.5 source code

2006-09-22 Thread Johnny Lee
Hello,My name is Johnny Lee. I have developed a *ahem* perl script which scans C/C++ source files for typos. I ran the typo.pl script on the released Python 2.5 source code. The scan took about two minutes and produced ~340 typos.After spending about 13 minutes weeding out the obvious false

Re: [Python-Dev] New relative import issue

2006-09-22 Thread Josiah Carlson
Phillip J. Eby [EMAIL PROTECTED] wrote: At 12:42 PM 9/22/2006 -0700, Josiah Carlson wrote: [snip] Measure it. Be sure to include the time to import SQLite vs. the time to import the zipimport module. [snip] Again, seriously, compare this against a zipfile. You'll find that there's

Re: [Python-Dev] Suggestion for a new built-in - flatten

2006-09-22 Thread glyph
On Fri, 22 Sep 2006 20:55:18 +0100, Michael Foord [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Fri, 22 Sep 2006 18:43:42 +0100, Michael Foord [EMAIL PROTECTED] wrote: This wouldn't be a problem except that everyone has a different idea of those requirements:). You didn't really

Re: [Python-Dev] list.discard? (Re: dict.discard)

2006-09-22 Thread Greg Ewing
[EMAIL PROTECTED] wrote: It's obvious for sets and dictionaries that there is only one thing to discard and that after the operation you're guaranteed the key no longer exists. Would you want the same semantics for lists or the semantics of list.remove where it only removes the first

Re: [Python-Dev] Typo.pl scan of Python 2.5 source code

2006-09-22 Thread Neal Norwitz
On 9/22/06, Johnny Lee [EMAIL PROTECTED] wrote: Hello, My name is Johnny Lee. I have developed a *ahem* perl script which scans C/C++ source files for typos. Hi Johnny. Thanks for running your script, even if it is written in Perl and ran on Windows. :-) The Python 2.5 typos can be

Re: [Python-Dev] Pep 353: Py_ssize_t advice

2006-09-22 Thread Martin v. Löwis
David Abrahams schrieb: b. We were using C++, which IIRC does not allow such redefinition You remember incorrectly. 16.3/2 (cpp.replace) says # An identifier currently defined as a macro without use of lparen (an # object-like macro) may be redefined by another #define preprocessing # directive

Re: [Python-Dev] GCC patch for catching errors in PyArg_ParseTuple

2006-09-22 Thread Martin v. Löwis
Giovanni Bajo schrieb: A way not to maintain this patch forever would be to devise a way to make format syntax pluggable / scriptable. There have been previous discussions on the GCC mailing lists. Perhaps. I very much doubt that this can or will be done, in a way that would support