[issue1816] sys.cmd_flags patch

2008-01-13 Thread Christian Heimes

Christian Heimes added the comment:

The new patch is using a struct sequence (like the result of os.stat):

 import sys
 sys.flags
sys.flags (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
 dir(sys.flags)
['__add__', '__class__', '__contains__', '__delattr__', '__doc__',
'__eq__', '__ge__', '__getattribute__', '__getitem__', '__getslice__',
'__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__',
'__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__',
'__repr__', '__rmul__', '__setattr__', '__str__', 'debug',
'division_new', 'division_warning', 'dont_write_bytecode',
'ingnore_environment', 'inspect', 'interactive', 'n_fields',
'n_sequence_fields', 'n_unnamed_fields', 'no_site', 'optimize',
'py3k_warning', 'tabcheck', 'unicode', 'verbose']
 sys.flags.debug
0

Please ignore the other files. They are part of my second PEP.

Added file: http://bugs.python.org/file9149/trunk_sys_flags.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1816
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1550] help('modules') broken by several 3rd party libraries (svn patch attached)

2008-01-13 Thread Ka-Ping Yee

Ka-Ping Yee added the comment:

Committed the patch in revision 59939.

I'm not clear how it was determined that importing every module was
necessary in order to list the modules or scan their synopsis lines
(this seems to have happened in revision 45510).  This can probably
be made more efficient in the future.

--
resolution:  - accepted
status: open - closed

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1550
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1367711] Remove usage of UserDict from os.py

2008-01-13 Thread Andrew Dalke

Andrew Dalke added the comment:

Ahh, so the bug here that the environ dict should use neither UserDict nor 
dict, it should implement the core {get,set,del}item and keys and use 
DictMixin.

Martin mentioned that the patch doesn't support setdefault.  He didn't note 
though that the current code also doesn't support the dictionary interface 
consistently.  This shows a problem with popitem.

 import os
 os.environ[USER]
'dalke'
 os.environ[USER] = nobody
 os.system(echo $USER)
nobody
0
 del os.environ[USER]
 os.system(echo $USER)

0
 os.environ[USER] = dalke
 while os.environ: print os.environ.popitem()
... 
('GROUP', 'staff')
('XDG_DATA_HOME', '/Users/dalke/.local/share')
('TERM_PROGRAM_VERSION', '133')
('CVS_RSH', 'ssh')
('LOGNAME', 'dalke')
('USER', 'dalke')
... removed for conciseness ...
('QTDIR', '/usr/local/qt')
 os.system(echo $USER)
dalke
0
 

Not enough people know about DictMixin.

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1367711
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1700288] Armin's method cache optimization updated for Python 2.6

2008-01-13 Thread Georg Brandl

Georg Brandl added the comment:

Backed out again in r59940 -- test_ctypes fails in test_incomplete.py.

Armin reports that with his original patch on 2.4, this test passes.

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1700288
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1700288] Armin's method cache optimization updated for Python 2.6

2008-01-13 Thread Kevin Jacobs

Kevin Jacobs added the comment:

All tests passed when I first ported Armin's patch to 2.6.  I'll have a
chance to look into this later in the week.  If anyone gets to it first,
please summarize your findings here to avoid duplication of effort.

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1700288
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1472] Small bat files to build docs on Windows

2008-01-13 Thread Georg Brandl

Georg Brandl added the comment:

FTR, I'm currently removing all 2.5isms from Sphinx.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1472
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1814] Victor Stinner's GMP patch for longs

2008-01-13 Thread Christian Heimes

Christian Heimes added the comment:

Why was the mpz module removed from Python 2.4 in the first place? 2.3
has  it.

I see three way to implement the option:

 * Let somebody implement a mpz type as a 3rd party extension.
 * Let somebody implement a mpt type and ship it with the Python core
 * Let somebody write a patch that replaces the built-in long type
implementation with a GMP based implementation (./configure
--with-gmp-integer)

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1814
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1816] sys.cmd_flags patch

2008-01-13 Thread Guido van Rossum

Guido van Rossum added the comment:

Can't you use a namedtuple?  Then printing it would show the names of
the flags...

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1816
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1816] sys.cmd_flags patch

2008-01-13 Thread Christian Heimes

Christian Heimes added the comment:

Guido van Rossum wrote:
 Can't you use a namedtuple?  Then printing it would show the names of
 the flags...

... and increase the startup costs of Python by loading several
additional modules. The collections module imports _collections,
operator and keyword. I'd rather see a better repr function for the
sequence types.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1816
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1816] sys.cmd_flags patch

2008-01-13 Thread Guido van Rossum

Guido van Rossum added the comment:

 I'd rather see a better repr function for the
 sequence types.

Agreed.  It's kind of unfortunate that we have two implementations for
the same concept, one in C and one in Python.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1816
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1816] sys.cmd_flags patch

2008-01-13 Thread Christian Heimes

Christian Heimes added the comment:

I've coded sys.flags for my per-user site-packages PEP. I could make it
a function but the function would be called by site.py on every startup.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1816
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1778] SyntaxError.offset sometimes wrong

2008-01-13 Thread Achim Gaedke

Achim Gaedke added the comment:

sometimes offset is None...

Example:
def blub(bla, blub=None, blabla):
bla

causes:
non-default argument follows default argument

Added file: http://bugs.python.org/file9150/compile_test.py

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1778
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1818] Add named tuple reader to CSV module

2008-01-13 Thread Raymond Hettinger

New submission from Raymond Hettinger:

Here's a proof-of-concept patch.  If approved, will change from
generator form to match the other readers and will add a test suite.

The idea corresponds to what is currently done by the dict reader but
returns a space and time efficient named tuple instead of a dict.  Field
order is preserved and named attribute access is supported.

A writer is not needed because named tuples can be feed into the
existing writer just like regular tuples.

--
assignee: barry
components: Library (Lib)
files: ntreader.diff
messages: 59866
nosy: barry, rhettinger
severity: normal
status: open
title: Add named tuple reader to CSV module
versions: Python 2.6
Added file: http://bugs.python.org/file9151/ntreader.diff

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1818
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1771] Remove cmp parameter to list.sort() and builtin.sorted()

2008-01-13 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Let's do this.  It is a nice simplification and makes the sort tools
easier to learn and use.

--
assignee:  - rhettinger
resolution:  - accepted

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1771
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue923643] long - byte-string conversion

2008-01-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Unless I'm mistaken, the patch provides only half of the solution: the
stringToLong part, but not longToString.
I agree this feature is interesting, not for optimization but becomes it
avoids using clunky ways (long - hex - bin) to implement something simple.
However, perhaps making it part of either the binascii or the struct
module would allow more formatting choices (e.g. big-endian or
little-endian, fixed-length or not). For example in cryptography you
would want a byte string of a fixed size even if your 512-bit number
happens to have its 8 most significant bits set to zero.

--
nosy: +pitrou


Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue923643

___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1816] sys.cmd_flags patch

2008-01-13 Thread Christian Heimes

Christian Heimes added the comment:

Does anybody see a problem with this repr slot implementation for
structseq? It gives this output:

 os.stat(.)
posix.stat_result st_mode=16832, st_ino=11666571L, st_dev=65025L,
st_nlink=20, st_uid=1000, st_gid=1000, st_size=4096L,
st_atime=1200261754, st_mtime=1200261721, st_ctime=1200261721

static PyObject *
structseq_repr(PyStructSequence *obj)
{
PyObject *tup, *val, *repr;
PyTypeObject *typ = Py_TYPE(obj);
int i, len;
char buf[250+5]; /* ...\0 */
char *cname, *crepr;
char *pbuf = buf;
char *endbuf = buf[250];

*pbuf++ = '';
strncpy(pbuf, typ-tp_name, 50);
pbuf += strlen(typ-tp_name)  50 ? 50 : strlen(typ-tp_name);
*pbuf++ = ' ';

if ((tup = make_tuple(obj)) == NULL) {
return NULL;
}
for (i=0; i  VISIBLE_SIZE(obj); i++) {
cname = typ-tp_members[i].name;
val = PyTuple_GetItem(tup, i);
if (cname == NULL || val == NULL) {
return NULL;
}
repr = PyObject_Repr(val);
if (repr == NULL) {
Py_DECREF(tup);
return NULL;
}
crepr = PyString_AsString(repr);
if (crepr == NULL) {
Py_DECREF(tup);
Py_DECREF(repr);
return NULL;
}
len = strlen(cname) + strlen(crepr) + 3;
if ((pbuf+len)  endbuf) {
strcpy(pbuf, cname);
pbuf += strlen(cname);
*pbuf++ = '=';
strcpy(pbuf, crepr);
pbuf += strlen(crepr);
*pbuf++ = ',';
*pbuf++ = ' ';
Py_DECREF(repr);
}
else {
strcpy(pbuf, ...);
pbuf += 5;
Py_DECREF(repr);
break;
}
}
Py_DECREF(tup);

pbuf-=2;
*pbuf++ = '';
*pbuf = '\0';

repr = PyString_FromString(buf);
return repr;
}

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1816
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1682] Move Demo/classes/Rat.py to Lib/rational.py and fix it up.

2008-01-13 Thread Jeffrey Yasskin

Jeffrey Yasskin added the comment:

_binary_float_to_ratio: Oops, fixed.

Rational() now equals 0, but I'd like to postpone Rational('3/2') until
there's a demonstrated need. I don't think it's as common a use as
int('3'), and there's more than one possible format, so some real world
experience will help (that is, quite possibly not in 2.6/3.0). I'm also
postponing Rational(instance_of_numbers_Rational).

+/-inf and nan are gone, and hash is fixed, at least until the next bug.
:) Good idea about using tuple.

Parentheses in str() help with reading things like
%s**2%Rational(3,2), which would otherwise format as 3/2**2. I don't
feel strongly about this.

Equality and the comparisons now work for complex, but their
implementations make me uncomfortable. In particular, two instances of
different Real types may compare unequal to the nearest float, but equal
to each other and have similar but inconsistent problems with =. I can
trade off between false ==s and false !=s, but I don't see a way to make
everything correct. We could do better by making the intermediate
representation Rational instead of float, but comparisons are inherently
doomed to run up against the fact that equality is uncomputable on the
computable reals, so it's probably not worthwhile to spend too much time
on this.

I've added a test that float(Rational(long('2'*400+'7'),
long('3'*400+'1'))) returns 2.0/3. This works without any explicit
scaling on my part because long.__truediv__ already handles it. If
there's something else I'm doing wrong around here, I'd appreciate a
failing test case.

The open issues I know of are:
 * Is it a good idea to have both numbers.Rational and
rational.Rational? Should this class have a different name?
 * trim and approximate: Let's postpone them to a separate patch (I do
think at least one is worth including in 2.6+3.0). So that you don't
waste time on them, we already have implementations in the sandbox and
(probably) a good-enough explanation at
http://en.wikipedia.org/wiki/Continued_fraction#Best_rational_approximations.
Thanks for the offer to help out with them. :)
 * Should Rational.from_float() exist and with the current name? If
there's any disagreement, I propose to rename it to
Rational._from_float() to discourage use until there's more consensus.
 * Rational.from_decimal(): punted to a future patch. I favor this for
2.6+3.0.
 * Rational('3/2') (see above)

I think this is close enough to correct to submit and fix up the
remaining problems in subsequent patches. If you agree, I'll do so.

Added file: http://bugs.python.org/file9152/rational.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1682
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1799] Per user site-packages and setup.py install --user patch

2008-01-13 Thread Christian Heimes

Christian Heimes added the comment:

The new patch adds the -s option, checks for getuid() == geteuid() and
adds sys.flags (see #1816).

Added file: http://bugs.python.org/file9153/trunk_usersite3.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1799
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1479611] speed up function calls

2008-01-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Here is a patch applicable for SVN trunk.
However, as Bob I have mixed results on this. For example, functions
with variable parameter count have become slower:

# With patch
$ ./python -m timeit -s def f(*x): pass 'for x in xrange(1): f(1)'
100 loops, best of 3: 4.92 msec per loop
$ ./python -m timeit -s def f(*x): pass 'for x in xrange(1): f()'
100 loops, best of 3: 4.07 msec per loop
$ ./python -m timeit -s def f(*x): pass 'for x in xrange(1): f(1,2)'
100 loops, best of 3: 5.04 msec per loop

# Without patch
$ ./python-orig -m timeit -s def f(*x): pass 'for x in xrange(1):
f(1)'
100 loops, best of 3: 4.22 msec per loop
$ ./python-orig -m timeit -s def f(*x): pass 'for x in xrange(1): f()'
100 loops, best of 3: 3.5 msec per loop
$ ./python-orig -m timeit -s def f(*x): pass 'for x in xrange(1):
f(1,2)'
100 loops, best of 3: 4.46 msec per loop

--
nosy: +pitrou
Added file: http://bugs.python.org/file9154/funcall.patch

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1479611
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1743] IDLE fails to launch

2008-01-13 Thread Kurt B. Kaiser

Kurt B. Kaiser added the comment:

1. Could you look at the properties of the .idlerc\recent-files.lst that you 
saved and compare them to the new file which worked?  In particular, what 
about access permissions?

2. I agree that IDLE should have a better error response if opening a user 
config file fails.

--
priority: low - normal

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1743
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1019] Cleanup pass on _curses and _curses_panel

2008-01-13 Thread A.M. Kuchling

Changes by A.M. Kuchling:


--
assignee: akuchling - 

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1019
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1700288] Armin's method cache optimization updated for Python 2.6

2008-01-13 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

After some debug work, I found an explanation:
- The attribute name is the name of a type slot. So it becomes cached
during the type construction.
- in function ctypes/_ctypes.c::StructUnionType_new(), the type's
__dict__ is replaced by a stgdict.
- this stgdict is then modified with PyDict_ functions, without any
call to _PyType_Lookup()
- the method cache becomes out of sync == boom.

I have come with a patch which corrects the problem, and all ctypes
tests pass:

Index: Modules/_ctypes/stgdict.c
===
--- Modules/_ctypes/stgdict.c   (revision 59939)
+++ Modules/_ctypes/stgdict.c   (working copy)
@@ -470,7 +470,7 @@
Py_DECREF(pair);
return -1;
}
-   if (-1 == PyDict_SetItem(realdict, name, prop)) {
+   if (-1 == PyObject_SetAttr(type, name, prop)) {
Py_DECREF(prop);
Py_DECREF(pair);
return -1;
Index: Modules/_ctypes/_ctypes.c
===
--- Modules/_ctypes/_ctypes.c   (revision 59939)
+++ Modules/_ctypes/_ctypes.c   (working copy)
@@ -410,7 +410,7 @@
 StructType_setattro(PyObject *self, PyObject *key, PyObject *value)
 {
/* XXX Should we disallow deleting _fields_? */
-   if (-1 == PyObject_GenericSetAttr(self, key, value))
+   if (-1 == Py_TYPE(self)-tp_base-tp_setattro(self, key, value))
return -1;

if (value  PyString_Check(key) 

I think that these changes are sensible: The first one deal with the
type's attribute instead of updating its __dict__, and the second
properly delegates tp_setattro to the base class ('type' in this case).

--
nosy: +amaury.forgeotdarc

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1700288
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1700288] Armin's method cache optimization updated for Python 2.6

2008-01-13 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Nice analysis.  Please apply.

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1700288
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1700288] Armin's method cache optimization updated for Python 2.6

2008-01-13 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

OK, I apply first my 2 lines, then the original patch.

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1700288
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1771] Remove cmp parameter to list.sort() and builtin.sorted()

2008-01-13 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Patch attached for the C files making them much cleaner and a bit
faster.   Still needs the related tests to be deleted and the docs
updated.

Added file: http://bugs.python.org/file9155/nocmp.diff

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1771
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1794] Hot keys must work in any keyboard layout

2008-01-13 Thread Kurt B. Kaiser

Changes by Kurt B. Kaiser:


--
nosy: +kbk

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1794
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1252] IDLE - patch Delegator to support callables

2008-01-13 Thread Kurt B. Kaiser

Changes by Kurt B. Kaiser:


--
resolution:  - rejected
status: open - closed

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1252
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1819] Speed hack for function calls with named parameters

2008-01-13 Thread Antoine Pitrou

New submission from Antoine Pitrou:

This is a patch for SVN trunk which substantially speeds up function
calls with named parameters. It does so by taking into account that
parameter names should be interned, so before doing full compares we do
a first quick loop to compare pointers.

On a microbenchmark the speedup is quite distinctive:

# With patch
$ ./python -m timeit -s def f(a,b,c,d,e): pass f(1,2,3,4,e=5)
100 loops, best of 3: 0.515 usec per loop
$ ./python -m timeit -s def f(a,b,c,d,e): pass f(a=1,b=2,c=3,d=4,e=5)
100 loops, best of 3: 0.652 usec per loop

# Without patch
$ ./python-orig -m timeit -s def f(a,b,c,d,e): pass f(1,2,3,4,e=5)
100 loops, best of 3: 0.664 usec per loop
$ ./python-orig -m timeit -s def f(a,b,c,d,e): pass
f(a=1,b=2,c=3,d=4,e=5)
100 loops, best of 3: 1.07 usec per loop

--
components: Interpreter Core
files: namedparam.patch
messages: 59878
nosy: pitrou
severity: normal
status: open
title: Speed hack for function calls with named parameters
versions: Python 2.6
Added file: http://bugs.python.org/file9156/namedparam.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1819
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1819] Speed hack for function calls with named parameters

2008-01-13 Thread Antoine Pitrou

Changes by Antoine Pitrou:


--
type:  - rfe

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1819
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1819] Speed hack for function calls with named parameters

2008-01-13 Thread Christian Heimes

Christian Heimes added the comment:

Nice! Is this somehow related to #1479611?

The formatting of the code looks kinda strange. Have you mixed tabs and
spaces?

--
assignee:  - gvanrossum
keywords: +patch
nosy: +gvanrossum, tiran
priority:  - high

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1819
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1819] Speed hack for function calls with named parameters

2008-01-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Sorry, my editor indents with spaces by default. Attaching a fixed patch
with tabs.

No, it is independent from #1479611 (and much simpler).

Added file: http://bugs.python.org/file9157/namedparam.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1819
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1700288] Armin's method cache optimization updated for Python 2.6

2008-01-13 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

For the record:
It is very wrong to call self-ob_type-tp_base's slot: slots are often
copied from their base class, and you get infinite recursion.
Calling StructType.tp_base-tp_setattro is much better.

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1700288
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1819] Speed hack for function calls with named parameters

2008-01-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Another quick test:

# With patch
$ ./python -m timeit -s d=dict(a=1,b=2,c=3,d=4,e=5);f = lambda
a,b,c,d,e:0 f(**d)
100 loops, best of 3: 0.727 usec per loop
$ ./python -m timeit -s d=dict(b=2,c=3,d=4,e=5);f = lambda a,b,c,d,e:0
f(a=1,**d)
100 loops, best of 3: 1.16 usec per loop
$ ./python -m timeit -s d=dict(b=2,c=3,d=4,e=5); f=lambda **kw:0 f(**d)
100 loops, best of 3: 0.917 usec per loop

# Without patch
$ ./python-orig -m timeit -s d=dict(a=1,b=2,c=3,d=4,e=5);f = lambda
a,b,c,d,e:0 f(**d)
100 loops, best of 3: 1.24 usec per loop
$ ./python-orig -m timeit -s d=dict(b=2,c=3,d=4,e=5);f = lambda
a,b,c,d,e:0 f(a=1,**d)
100 loops, best of 3: 1.62 usec per loop
$ ./python-orig -m timeit -s d=dict(b=2,c=3,d=4,e=5); f=lambda **kw:0
f(**d)
100 loops, best of 3: 0.904 usec per loop

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1819
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1799] Per user site-packages and setup.py install --user patch

2008-01-13 Thread Gregory P. Smith

Gregory P. Smith added the comment:

nice.  ping a mac developer for what to do with the darwin stuff that
you commented out.

It'd also be nice to have unit tests for the new behavior.  Though i
don't think we have many (any?) of that type of regression test right
now.  Such a test would need to setup a test user site package,
os.system another instance python with and without -s to confirm if it
saw the test site package that was just created or not followed by
cleaning it all up.

--
nosy: +gregory.p.smith

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1799
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1682] Move Demo/classes/Rat.py to Lib/rational.py and fix it up.

2008-01-13 Thread Mark Dickinson

Mark Dickinson added the comment:

The latest version of rational.py looks good to me---nice work!  (I haven't 
looked properly at 
numbers.py or test_rational.py, yet.  I do plan to, eventually.)

I do think it's important to be able to create Rational instances from strings: 
 e.g., for 
easy reading from and writing to files.  But maybe I'm alone in this opinion.  
You say there's 
more than one possible format---what other formats were you considering?

And since you pointed it out, I think Rational(Rational(a, b)) should work too.

There's also the not-entirely-insignificant matter of documentation :)

Other than that, I don't see why this shouldn't go in.

Other comments:

I have a weak preference for no parentheses on the str() of a Rational, but 
it's no big deal 
either way.

I agree that equality and comparisons are messy.  This seems almost inevitable: 
 one obvious 
cause is that the existing int - float comparisons already break the `numeric 
tower' model 
(push both operands to the highest common type before operating).  So I'm not 
sure there can 
be an easy and elegant solution here :(

I like the name Rational for this class.  Maybe change the name of 
numbers.Rational instead?

Postponing trim, approximate, from_decimal sounds fine to me.

Finally:  the very first line of rational.py is, I think, no longer accurate.  
Please add your 
name so everyone knows who to blame/credit/assign bug reports to :)

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1682
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1771] Remove cmp parameter to list.sort() and builtin.sorted()

2008-01-13 Thread Guido van Rossum

Guido van Rossum added the comment:

Cool!  Doesn't it feel good to rip out stuff? :-)

I do hope that you'll make sure all tests pass (-uall) before submitting
this.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1771
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1682] Move Demo/classes/Rat.py to Lib/rational.py and fix it up.

2008-01-13 Thread Mark Dickinson

Mark Dickinson added the comment:

Just had a quick look at numbers.py.  Only two comments:

1. I think there's a typo in the docstring for Inexact:  one of those == should 
be a != 

2. Not that it really matters now, but note that at least for Decimal, x-y is 
not the same 
as x+(-y)  (I'm looking at Complex.__sub__), and +x is not a no-op (Real.real, 
Real.conjugate).  In both cases signs of zeros can be problematic:

 x = Decimal('-0')
 y = Decimal('0')
 x-y
Decimal(-0)
 x+(-y)
Decimal(0)
 x
Decimal(-0)
 +x
Decimal(0)

Of course the first point wouldn't matter anyway since Decimal already 
implements __sub__;  
the second means that if Decimal were to join Real,  something would need to be 
done to 
avoid Decimal(-0).real becoming Decimal(0).

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1682
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1816] sys.cmd_flags patch

2008-01-13 Thread Guido van Rossum

Guido van Rossum added the comment:

Nice -- perhaps you can make it look like a function call,
posix.stat_result(st_mode=..., ...)?  (Then someone else might finally
create a constructor with such a signature. :-)

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1816
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1820] Enhance Object/structseq.c to match namedtuple and tuple api

2008-01-13 Thread Christian Heimes

New submission from Christian Heimes:

Raymond Hettinger wrote:

Here's a couple more if you want to proceed down that path:

1. Have structseq subclass from PyTupleObject so that isinstance(s,
tuple) returns True.  This makes the object usable whenever 
tuples are needed.

2. Add _fields, _asdict, and _replace to match the API in
collections.namedtuple().  The _fields tuple should only include the 
visible positional fields while _asdict() and _replace() should include
all of the fields whether visible or accessible only by 
attribute access.

3. Change the constructor to accept keyword args so that eval(repr(s))
== s works.

NOTE:
I've marked the task as easy but it's not a task for a total newbie.
It's a feasible yet challenging task for somebody who likes to get into
CPython core programming. Basic C knowledge is required!

--
components: Interpreter Core
keywords: easy
messages: 59888
nosy: rhettinger, tiran
priority: low
severity: normal
status: open
title: Enhance Object/structseq.c to match namedtuple and tuple api
type: rfe
versions: Python 2.6, Python 3.0

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1820
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1816] sys.cmd_flags patch

2008-01-13 Thread Christian Heimes

Christian Heimes added the comment:

Committed in r59947, r59948 and r59949

--
resolution:  - fixed
status: open - closed

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1816
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1799] Per user site-packages and setup.py install --user patch

2008-01-13 Thread Christian Heimes

Changes by Christian Heimes:


Added file: http://bugs.python.org/file9158/trunk_usersite4.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1799
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1799] Per user site-packages and setup.py install --user patch

2008-01-13 Thread Christian Heimes

Changes by Christian Heimes:


Removed file: http://bugs.python.org/file9131/trunk_usersite.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1799
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1799] Per user site-packages and setup.py install --user patch

2008-01-13 Thread Christian Heimes

Changes by Christian Heimes:


Removed file: http://bugs.python.org/file9153/trunk_usersite3.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1799
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue779460] plistlib should be moved out of plat-mac

2008-01-13 Thread surekap

surekap added the comment:

Request we reopen this issue since it was marked duplicate of #1565129
and both were closed but the problem was not resolved. plistlib.py did
not make it into Python 2.5.

--
nosy: +surekap


Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue779460

___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1820] Enhance Object/structseq.c to match namedtuple and tuple api

2008-01-13 Thread Leif Walsh

Leif Walsh added the comment:

Here is a patch for #1.  I ran make test, and nothing was broken that
seemed to be my fault, so I assume it's okay.

Yes, it's small, it's my first one here.  I'll get to the other two
tomorrow.

--
nosy: +adlaiff6
Added file: http://bugs.python.org/file9159/structseq_subclasses_tuple.diff

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1820
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com