[issue2706] datetime: define division timedelta/timedelta

2009-03-10 Thread Fredrik Johansson

Fredrik Johansson fredrik.johans...@gmail.com added the comment:

I think datetime division would be a fine application for Fractions.

--
message_count: 18.0 - 19.0
nosy: +fredrikj
nosy_count: 7.0 - 8.0

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



[issue5465] No edit in IDLE in right click context menu

2009-03-10 Thread Martin v. Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

That's not a bug. When you installed 2.5, you had defined that files are
associated with 2.5. When you uninstalled 2.5, those associations were
removed. In Add and Remove Programs, find 2.6, and run a Repair
installation to get the files associated with 2.6.

--
message_count: 1.0 - 2.0
nosy: +loewis
nosy_count: 1.0 - 2.0
resolution:  - invalid
status: open - closed

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



[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-03-10 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

http://mail.python.org/pipermail/python-ideas/2009-February/002873.html

--
message_count: 19.0 - 20.0

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



[issue5445] codecs.StreamWriter.writelines problem when passed generator

2009-03-10 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

For the common case where list is in fact a sequence of strings, the
used implementation is a lot faster and more efficient than the one you
propose.

Note that the method doesn't pretend to support generators for the list
argument, so adding support for iterators would be a feature request,
not a bug report. 

Furthermore, the StreamWriter method can easily be overridden by the
codec's own implementation (the version in codecs.py is the base method
defining the interface and providing a default implementation), so
adding support to the base method will not necessarily mean that all
codecs then support iterators as parameter to .writelines().

IMHO, it's better to use the .write() method in a for-loop of your
application if you want to support iterators that generate a lot of output.

--
message_count: 2.0 - 3.0
nosy: +lemburg
nosy_count: 2.0 - 3.0
type:  - feature request

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



[issue5463] Compiler warning get_ulong is never used 3.x

2009-03-10 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Thanks for the patch!  Certainly it's desirable to get rid
of this warning, especially as in this case the warning indicates
a genuine problem:  namely that there's unused code floating around. 

I think it would not be unreasonable to simply remove the code
that's #ifdef'd away.  It was there for backwards compatibility,
and should no longer be needed in 3.0 and 3.1.

--
message_count: 1.0 - 2.0
nosy: +marketdickinson
nosy_count: 1.0 - 2.0

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



[issue4540] typo in a module describes utf-8 as uft-8

2009-03-10 Thread Jervis Whitley

Jervis Whitley jervi...@gmail.com added the comment:

I can still reproduce on py3

 help(modules anything)

Traceback (most recent call last):
...

This patch works (on Py3.1a1). 


Amaury, are you still o.k with catching Exception rather
than just (SyntaxError, UnicodeDecodeError, ImportError)?

The code-refactoring does clean the structure up well.

Cheers,

Jervis

--
message_count: 9.0 - 10.0
nosy: +jdwhitley
nosy_count: 3.0 - 4.0

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



[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-03-10 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

Terry covered how to document the feature in his original description of
the proposal. After the phrase either the numeric
index of a positional argument, or the name of a keyword argument. in
the docs, add a sentence along the lines of the following:

  If the index/name is left out for all replacement fields, then the
sequential values 0, 1, ... will be automatically inserted.

--
message_count: 20.0 - 21.0

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



[issue5237] Allow auto-numbered replacement fields in str.format() strings

2009-03-10 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

It may also be worth explicitly stating the following in the docs: Note
that automatically numbered and explcitly namged/numbered replacement
fields cannot be mixed in a single format string. (This could probably
be relegated to a footnote).

This proposal is also significantly better defined than the rather
bizarre behaviour seen in the equivalent situation with %-formatting:

 %s %(name)s % dict(name=Hmm)
{'name': 'Hmm'} Hmm

 %s %(name)s %s % dict(name=Hmm)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: not enough arguments for format string

 %s %(name)s %s % (dict(name=Hmm), dodgy)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: format requires a mapping

--
message_count: 21.0 - 22.0

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



[issue4847] csv fails when file is opened in binary mode

2009-03-10 Thread Skip Montanaro

Skip Montanaro s...@pobox.com added the comment:

This issue seems to have simply been overlooked when 3.0 was released.
It should be fixed in the next round of 3.0 and 3.1 updates.  Any
feeback on the idea that the csv.reader constructor (and probably the
DictReader and proposed NamedTupleReader constructors) should take an
optional encoding argument?  In fact, the writers should as well
which would inform the writer how to encode the output when writing.

--
message_count: 21.0 - 22.0
priority: normal - release blocker

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



[issue4510] ValueError for list.remove() not very helpful

2009-03-10 Thread Tim Lesher

Changes by Tim Lesher tles...@gmail.com:


--
nosy: +tlesher
nosy_count: 2.0 - 3.0

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



[issue5443] trivial typo in itertools documentation

2009-03-10 Thread Lorenz Quack

Lorenz Quack d...@amberfisharts.com added the comment:

Thanks for fixing.
But I'm afraid you missed the second typo in this Bug.
It's the same thing one line beneath the one you fixed.

next time I'll attach a patch. I promise.

--
message_count: 2.0 - 3.0
status: closed - open

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



[issue5443] trivial typo in itertools documentation

2009-03-10 Thread Lorenz Quack

Lorenz Quack d...@amberfisharts.com added the comment:

FWIW here is the patch.
It is against r70267 of the trunk

--
keywords: +patch
message_count: 3.0 - 4.0
Added file: http://bugs.python.org/file13291/itertools.patch

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2009-03-10 Thread Jeffrey C. Jacobs

Jeffrey C. Jacobs timeho...@users.sourceforge.net added the comment:

Okay, as I said, Atomic Grouping, etc., off a recent 2.6 is already 
available and I can do any cleanups requested to those already 
mentioned, I just don't want to start any new items at the moment.  As 
it is, we are still over a year from any of this seeing the light of day 
as it's not going to be merged until we start 2.7 / 3.1 alpha.

Fortunately, I think Matthew here DOES have a lot of potential to have 
everything wrapped up by then, but I think to summarize everyone's 
concern, we really would like to be able to examine each change 
incrementally, rather than as a whole.  So, for the purposes of this, I 
would recommend that you, Matthew, make a version of your new engine 
WITHOUT any Atomic Group, variable length look behind / ahead 
assertions, reverse string scanning, positional, negated or scoped 
inline flags, group key indexing or any other feature described in the 
various issues, and that we then evaluate purely on the merits of the 
engine itself whether it is worth moving to that engine, and having made 
that decision officially move all work to that design if warranted.  
Personally, I'd like to see that 'pure' engine for myself and maybe we 
can all develop an appropriate benchmark suite to test it fairly against 
the existing engine.  I also think we should consider things like 
presentation (are all lines terminated by column 80), number of 
comments, and general readability.  IMHO, the current code is conformant 
in the line length, but VERY deficient WRT comments and readability, the 
later of which it sacrifices for speed (as well as being retrofitted for 
iteration rather than recursion).  I'm no fan of switch-case, but I 
found that by turning the various case statements into bite-sized 
functions and adding many, MANY comments, the code became MUCH more 
readable at the minor cost of speed.  As I think speed trumps 
readability (though not blindly), I abandoned my work on the engines, 
but do feel that if we are going to keep the old engine, I should try 
and adapt my comments to the old framework to make the current code a 
bit easier to understand since the framework is more or less the same 
code as in the existing engine, just re-arranged.

I think all of the things you've added to your engine, Matthew, can, 
with varying levels of difficulty be implemented in the existing Regexp 
Engine, though I'm not suggesting that we start that effort.  Simply, 
let's evaluate fairly whether your engine is worth the switch over.  
Personally, I think the engine has some potential -- though not much 
better than current WRT readability -- but we've only heard anecdotal 
evidence of it's superior speed.  Even if the engine isn't faster, 
developing speed benchmarks that fairly gage any potential new engine 
would be handy for the next person to have a great idea for a rewrite, 
so perhaps while you peruse the stripped down version of your engine, 
the rest of us can work on modifying regex_tests.py, test_re.py and 
re_tests.py in Lib/test specifically for the purpose of benchmarking.

If we can focus on just these two issues ('pure' engine and fair 
benchmarks) I think I can devote some time to the later as I've dealt a 
lot with benchmarking (WRT the compiler-cache) and test cases and hope 
to be a bit more active here.

--
message_count: 69.0 - 70.0

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2009-03-10 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 Okay, as I said, Atomic Grouping, etc., off a recent 2.6 is already 
 available and I can do any cleanups requested to those already 
 mentioned, I just don't want to start any new items at the moment.  As 
 it is, we are still over a year from any of this seeing the light of day 
 as it's not going to be merged until we start 2.7 / 3.1 alpha.

3.1 will actually be released, if all goes well, before July of this
year. The first alpha was released a couple of days ago. The goal is to
fix most deficiencies of the 3.0 release.

See http://www.python.org/dev/peps/pep-0375/ for the planned release
schedule.

--
message_count: 70.0 - 71.0

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2009-03-10 Thread Jeffrey C. Jacobs

Jeffrey C. Jacobs timeho...@users.sourceforge.net added the comment:

Thanks, Antione!  Then I think for the most part any changes to Regexp 
will have to wait for 3.2 / 2.7.

--
message_count: 71.0 - 72.0

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



[issue5466] Tix.Balloon causes TCLError: unknown color name {#ffff60} in Python 2.6.1

2009-03-10 Thread Andrew Gregory

New submission from Andrew Gregory andrew.greg...@npl.co.uk:

All programs using Tix.Balloon in Python 2.6.1 (Windows XP) crash when 
a Tix.Balloon object is created. The Balloon.py Tix demo is supplied as 
an example.

Andrew.

--
components: Tkinter
files: Balloon.py
message_count: 1.0
messages: 83430
nosy: andrewp22
nosy_count: 1.0
severity: normal
status: open
title: Tix.Balloon causes TCLError: unknown color name {#60} in Python 
2.6.1
type: crash
versions: Python 2.6
Added file: http://bugs.python.org/file13292/Balloon.py

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



[issue4540] typo in a module describes utf-8 as uft-8

2009-03-10 Thread dariusp

dariusp dari...@internode.on.net added the comment:

This appears to be the same issue as described in 5453 in which I
supplied a patch for release30-maint and py3k branches.

It's probably useful to address both issue 4540  5453 at the same time.

I would have added to this issue, but I didn't see it when I raised 5453.

On a side note, the line importer.find_module(modname) in pydoc.py line
1925 appears that it may return None.  If this is the case then the None
return value should be handled.

--
message_count: 10.0 - 11.0
nosy: +dariusp
nosy_count: 4.0 - 5.0

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



[issue5431] cmpfunc in Python 3.0.1 windows installer

2009-03-10 Thread Nigel Galloway

Nigel Galloway nigel_gallo...@yahoo.com added the comment:

Not quite an answer to the question. I have built this wrapper with 
the change to Python indicated. It seems to work. It does not complain 
about unresolved references. Is this satisfactory for 3.0.1, with 
perhaps a change to SWIG from 3.1. Or must I obtain Python 3.0 and 
start again?

--
message_count: 4.0 - 5.0
status: closed - open

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



[issue5467] tools\msi\merge.py is sensitive to lack of config.py

2009-03-10 Thread Tim Golden

New submission from Tim Golden m...@timgolden.me.uk:

tools\msi\merge.py attempts to import config and fails with an
ImportError if it doesn't exist (which it doesn't by default). msi.py
catches this exception and ignores it.

The attached patch carries the same behaviour over to merge.py

--
components: Installation
files: merge.patch
keywords: patch
message_count: 1.0
messages: 83433
nosy: tim.golden
nosy_count: 1.0
severity: normal
status: open
title: tools\msi\merge.py is sensitive to lack of config.py
versions: Python 2.7, Python 3.1
Added file: http://bugs.python.org/file13293/merge.patch

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



[issue5468] urlencode does not handle bytes, and could easily handle alternate encodings

2009-03-10 Thread Dan Mahn

New submission from Dan Mahn dan.m...@digidescorp.com:

urllib.parse.urlencode() uses quote_plus() extensively to create a
complete query string, but doesn't effectively/properly take advantage
of the flexibility built into quote_plus().  Namely:

1) Instances of type bytes are not properly encoded, as str() is used
prior to passing to quote_plus().  This creates a nonsensical string
such as b'1234', while quote_plus() can handle these types properly if
passed intact.  The ability to encode this type is particularly useful
for putting binary data into the query string, or for pre-encoded text
which you may want to encode in a non-standard character encoding.

2) Sometimes it would be desirable to encode query strings entirely in
latin-1 or possibly ascii instead of utf-8.  Adding the extra
parameters now present on quote_plus() can easily give that extra
functionality.

I have attached a new version of urlencode() that provides both of the
above fixes/enhancements.  Additionally, an unused codepath in the
existing function has been eliminated/cleaned up.  Some doctests are
included as well.

--
components: Library (Lib)
files: new_urlencode.py
message_count: 1.0
messages: 83434
nosy: dmahn
nosy_count: 1.0
severity: normal
status: open
title: urlencode does not handle bytes, and could easily handle alternate 
encodings
type: behavior
versions: Python 3.0, Python 3.1
Added file: http://bugs.python.org/file13294/new_urlencode.py

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



[issue5445] codecs.StreamWriter.writelines problem when passed generator

2009-03-10 Thread Daniel Lescohier

Daniel Lescohier daniel.lescoh...@cbs.com added the comment:

In Python's file protocol, readlines and writelines is a protocol for 
iterating over a file. In Python's file protocol, if one doesn't want 
to iterate over the file, one calls read() with no argument in order 
to read the whole file in, or one calls write() with the complete 
contents you want to write.

If writelines is using join, then if one passes an iterator as the 
parameter to writelines, it will not iteratively write to the file, it 
will accumulate everything in memory until the iterator raises 
StopIteration, and then write to the file.  So, if one is tailing the 
output file, one is not going to see anything in the file until the 
end, instead of iteratively seeing content.  So, it's breaking the 
promise of the file protocol's writelines meaning iteratively write.

I think following the protocol is more important than performance. If 
the application is having performance problems, it's up to the 
application to buffer the data in memory and make a single write call.

However, here is an alternative implementation that is slightly more 
complicated, but possibly has better performance for the passed-a-list 
case.  It covers three cases:

1. Passed an empty sequence; do not call self.write at all.
2. Passed a sequence with a length. That implies that all the data is 
available immediately, so one can concantenate and write with one 
self.write call.
3. Passed a sequence with no length.  That implies that all the data 
is not available immediately, so iteratively write it.

def writelines(self, sequence):

 Writes the sequence of strings to the stream
using .write().

try:
sequence_len = len(sequence)
except TypeError:
write = self.write
for value in sequence:
write(value)
return
if sequence_len:
self.write(''.join(sequence))

I'm not sure which is better.  But one last point is that Python is 
moving more in the direction of using iterators; e.g., in Py3K, 
replacing dict's keys, values, and items with the implementation of 
iterkeys, itervalues, and iteritems.

--
message_count: 3.0 - 4.0

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




[issue5445] codecs.StreamWriter.writelines problem when passed generator

2009-03-10 Thread Daniel Lescohier

Daniel Lescohier daniel.lescoh...@cbs.com added the comment:

Let me give an example of why it's important that writelines 
iteratively writes.  For:

rows = (line[:-1].split('\t') for line in in_file)
projected = (keep_fields(row, 0, 3, 7) for row in rows)
filtered = (row for row in projected if row[2]=='1')
out_file.writelines('\t'.join(row)+'\n' for row in filtered)

For a large input file, for a regular out_file object, this will work. 
For a codecs.StreamWriter wrapped out_file object, this won't work, 
because it's not following the file protocol that writelines should 
iteratively write.

--
message_count: 4.0 - 5.0

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



[issue5445] codecs.StreamWriter.writelines problem when passed generator

2009-03-10 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

On 2009-03-10 16:36, Daniel Lescohier wrote:
 Daniel Lescohier daniel.lescoh...@cbs.com added the comment:
 
 Let me give an example of why it's important that writelines 
 iteratively writes.  For:
 
 rows = (line[:-1].split('\t') for line in in_file)
 projected = (keep_fields(row, 0, 3, 7) for row in rows)
 filtered = (row for row in projected if row[2]=='1')
 out_file.writelines('\t'.join(row)+'\n' for row in filtered)
 
 For a large input file, for a regular out_file object, this will work. 
 For a codecs.StreamWriter wrapped out_file object, this won't work, 
 because it's not following the file protocol that writelines should 
 iteratively write.

Of course, it's possible to have a generator producing lots of data,
but that does not warrant making most uses of that method slow.

If you'd like to see such support in .writelines(), please provide
an implementation that follows the approach of the file object
implementation in Python 2.x: it writes the lines in chunks of
1000 lines each, if it finds that the input object is not a sequence
(actually, it's stricter than that for some: it requires a Python
list).

The standard case of passing a list of strings to that method
should not get slower because of this.

BTW: I am not aware of any .writelines() file protocol. If there
were such a protocol, .readlines() would also have to return
an iterator (which it doesn't). The idea behind .writelines()
is to be able to write back a list generated with .readlines().

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com



::: Try our new mxODBC.Connect Python Database Interface for free ! 

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/

--
message_count: 5.0 - 6.0

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



[issue2771] test issue

2009-03-10 Thread Daniel Diniz

Daniel Diniz aja...@gmail.com added the comment:

Reviewers: ,

Description:
 From http://bugs.python.org/issue2771

Testing 1..2..3

Description fetched from: http://bugs.python.org/msg82496

Please review this at http://codereview.appspot.com/22062

Affected files:
   M static/upload.py

--
message_count: 8.0 - 9.0

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



[issue5469] Reference paragraph about the constructs that bind names needs updating for Python 3

2009-03-10 Thread Mitchell Model

New submission from Mitchell Model m...@acm.org:

In the Python Language Reference, in the Naming and binding section of 
Execution Model, there is a paragraph that states:

The following constructs bind names: formal parameters to functions, 
import statements, class and function definitions (these bind the class 
or function name in the defining block), and targets that are 
identifiers if occurring in an assignment, for loop header, or in the 
second position of an except clause header. The import statement of the 
form “from ...import *” binds all names defined in the imported module, 
except those beginning with an underscore. This form may only be used at 
the module level.

This misdescribes the except clause, which now uses as, and omits the 
with ... as construct which also binds names.

--
assignee: georg.brandl
components: Documentation
message_count: 1.0
messages: 83439
nosy: MLModel, georg.brandl
nosy_count: 2.0
severity: normal
status: open
title: Reference paragraph about the constructs that bind names needs updating 
for Python 3
versions: Python 3.0, Python 3.1

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



[issue5470] MSI installer misses zipdir.zip file in Lib\test

2009-03-10 Thread Tim Golden

New submission from Tim Golden m...@timgolden.me.uk:

The msi.py determines which files to carry over into the installer for
the lib\test directory. zipdir.zip was added recently for test_zipfile
and this isn't picked up. The attached patch adds it in.

--
components: Installation
files: msi-zipdir.patch
keywords: patch
message_count: 1.0
messages: 83440
nosy: tim.golden
nosy_count: 1.0
severity: normal
status: open
title: MSI installer misses zipdir.zip file in Lib\test
versions: Python 2.7, Python 3.1
Added file: http://bugs.python.org/file13295/msi-zipdir.patch

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



[issue891930] configure argument --libdir is ignored

2009-03-10 Thread jan matejek

Changes by jan matejek jmate...@suse.cz:


--
nosy: +matejcik
nosy_count: 3.0 - 4.0

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



[issue1019715] distutils ignores configure's --includedir

2009-03-10 Thread jan matejek

Changes by jan matejek jmate...@suse.cz:


--
nosy: +matejcik
nosy_count: 3.0 - 4.0

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



[issue5445] codecs.StreamWriter.writelines problem when passed generator

2009-03-10 Thread Daniel Lescohier

Daniel Lescohier daniel.lescoh...@cbs.com added the comment:

OK, I think I see where I went wrong in my perceptions of the file 
protocol.  I thought that readlines() returned an iterator, not a 
list, but I see in the library reference manual on File Objects that 
it returns a list.  I think I got confused because there is no 
equivalent of __iter__ for writing to streams.  For input, I'm always 
using 'for line in file_object' (in other words, 
file_object.__iter__), so I had assumed that writelines was the mirror 
image of that, because I never use the readlines method.  Then, in my 
mind, readlines became the mirror image of writelines, which I had 
assumed took an iterator, so I assumed that readlines returned an 
iterator.  I wonder if this perception problem is common or not.

So, the StreamWriter interface matches the file protocol; readlines() 
and writelines() deal with lists.  There shouldn't be any change to 
it, because it follows the protocol.

Then, the example I wrote would be instead:

rows = (line[:-1].split('\t') for line in in_file)
projected = (keep_fields(row, 0, 3, 7) for row in rows)
filtered = (row for row in projected if row[2]=='1')
formatted = (u'\t'.join(row)+'\n' for row in filtered)
write = out_file.write
for line in formatted:
write(line)

I think it's correct that the file object write C code only does 
1000-line chunks for sequences that have a defined length: if it has a 
defined length, then that implies that the data exists now, and can be 
concatenated and written now.  Something without a defined length may 
be a generator with items arriving later.

--
message_count: 6.0 - 7.0

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



[issue5276] IDLE startup file .Idle.py not documented

2009-03-10 Thread Brad Miller

Brad Miller bonel...@gmail.com added the comment:

Here's a simple patch that documents the different startup files.  It is 
missing a good use case for .Idle.py but I'd be happy to add that if 
someone can give me one.

--
keywords: +patch
message_count: 1.0 - 2.0
nosy: +bmiller
nosy_count: 2.0 - 3.0
Added file: http://bugs.python.org/file13296/idlestartdoc.patch

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



[issue5466] Tix.Balloon causes TCLError: unknown color name {#ffff60} in Python 2.6.1

2009-03-10 Thread Guilherme Polo

Guilherme Polo ggp...@gmail.com added the comment:

Unfortunately this is a tix issue, so we can't fix it from python. See
http://sourceforge.net/tracker/index.php?func=detailaid=1864027group_id=5649atid=105649

Leaving this open as a reminder to incldue a newer tix in the next releases.

--
message_count: 1.0 - 2.0
nosy: +gpolo
nosy_count: 1.0 - 2.0
versions: +Python 2.7, Python 3.1 -Python 2.6

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



[issue2610] string representation of range and dictionary views

2009-03-10 Thread Brad Miller

Brad Miller bonel...@gmail.com added the comment:

Just to restart the discussion on the original issue since I see that 
the latest 3.1 has solved the problem with dict_keys, dict_values, etc 
al objects.  Many thanks!

A suggestion was made by Alexander to create a custom displayhook that 
could be included in the standard library.  From the research I've done 
it looks like a solution for range would be something like the 
following:

import sys
def eduhook(o):
if o is None:
return
if isinstance(o,range):
print(list(o))
else:
print(repr(o))

sys.displayhook = eduhook

Now if 5233/5234 were approved I could tell my students to setup an 
environment variable PYTHONSTARTUP that points to a file that imports a 
module containing the above code.  (or I could just tell them to import 
said module each time.)

The above hook appears to work fine.  Is there anything obvious I'm 
missing?  If this is along the right track then I could extend it to 
support other custom display ideas that my fellow educators have in 
mind.

Thanks,

Brad

--
message_count: 30.0 - 31.0

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



[issue5471] os.path.expanduser('~') doesnt works correctly when HOME is '/'

2009-03-10 Thread pancake

New submission from pancake panc...@nopcode.org:

When the HOME path is just '/' python says that the home path is 
(zero length string)

I was able to reproduce this issue in 2.5.2 and 2.6 (no idea about 3.0)

Here's an example:

$ HOME=/ python -c 'import os;print os.path.expanduser(~)'

$ HOME=/tmp python -c 'import os;print os.path.expanduser(~)'
/tmp

$ HOME=a python -c 'import os;print os.path.expanduser(~)'
a

--8--

I just used if !os.path.isdir(os.path.expanduser('~')): check in
my application to avoid messing around the resulting paths when the
application runs.

The correct response should be '/' instead of ''.

--
components: None
message_count: 1.0
messages: 83445
nosy: pancake
nosy_count: 1.0
severity: normal
status: open
title: os.path.expanduser('~') doesnt works correctly when HOME is '/'
type: behavior
versions: Python 2.6

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



[issue5471] os.path.expanduser('~') doesnt works correctly when HOME is '/'

2009-03-10 Thread Guilherme Polo

Guilherme Polo ggp...@gmail.com added the comment:

Patch with a test attached.

--
keywords: +patch
message_count: 1.0 - 2.0
nosy: +gpolo
nosy_count: 1.0 - 2.0
versions: +Python 2.7, Python 3.0, Python 3.1
Added file: http://bugs.python.org/file13297/issue_5471.diff

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



[issue2706] datetime: define division timedelta/timedelta

2009-03-10 Thread Tennessee Leeuwenburg

Tennessee Leeuwenburg tleeuwenb...@gmail.com added the comment:

Hi all,

I'm trying to help out by reviewing issues in the tracker... so this is 
just a first attempt and I hope it is somewhat useful. This issue covers 
a number of discrete functional changes. I here review each in turn:

1) Allow truediv, the operator '/', to be applied to two timedeltas 
(e.g. td1 / td2). The return value is a float representing the number of 
times that td2 goes into td1.

Evaluation: Since both time deltas are quantitative values of the same 
unit, it makes sense they should be able to support basic math 
operations. In this case, operation to be added is '/' or truediv. I 
would personally find this functionality useful, and believe it is a 
natural addition to the code.

Recommendation: That this functionality be recommended for development

2) Allow truediv to be applied to a timedelta and an int or float. The 
return value is a timedelta representing the fractional proportion of 
the original timedelta.

Evaluation: This makes total sense.
Recommendation: That this functionality be recommended for development

2) Allow divmod, the operator '%', to be applied to two timedeltas (e.g. 
td1 % td2). I think there is some debate here about whether the return 
value be an integer in microsends, or a timedelta. I personally believe 
that a timedelta should be returned, representing the amount of time 
remaining after (td1 // td2)  * td2 has been subtracted.

The alternative is an integer, but due to a lack of immediate clarity 
over what time quanta this integer represents, I would suggest returning 
a unit amount. There is also some discussion of returning (long, 
timedelta), but I personally fail to see the merits of returning the 
long without some unit attached.

3) Allow divmod, the operator '%', to be applied to a timedelta and an 
integer or float. (e.g. timedelta % 3). I'm not quite as sold on this.  
I suggest that more discussion is required to flesh this out further.


A patch has been attached which implements some of this behaviour. I 
would suggest that it's valuable to start doing this work in discrete 
chunks so that progress can be begun before the issues under debate are 
resolved. I suggest that it would be appropriate to create three smaller 
issues, each tackling just one piece of functionality. This should make 
the changes more atomic and the code patch simpler.

-T

--
message_count: 19.0 - 20.0

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



[issue5467] tools\msi\merge.py is sensitive to lack of config.py

2009-03-10 Thread Martin v. Löwis

Changes by Martin v. Löwis mar...@v.loewis.de:


--
assignee:  - loewis
nosy: +loewis
nosy_count: 1.0 - 2.0
priority:  - high

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



[issue5470] MSI installer misses zipdir.zip file in Lib\test

2009-03-10 Thread Martin v. Löwis

Changes by Martin v. Löwis mar...@v.loewis.de:


--
assignee:  - loewis
nosy: +loewis
nosy_count: 1.0 - 2.0
priority:  - release blocker

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



[issue5468] urlencode does not handle bytes, and could easily handle alternate encodings

2009-03-10 Thread Dan Mahn

Dan Mahn dan.m...@digidescorp.com added the comment:

I also made some tests for the new code that could be added to the unit
tests in test_urllib.py

--
message_count: 1.0 - 2.0
Added file: http://bugs.python.org/file13298/new_urlencode_tests.py

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



[issue5472] distutils.test_util fails to restore os.uname

2009-03-10 Thread Tim Golden

New submission from Tim Golden m...@timgolden.me.uk:

lib\distutils\tests\test_util.py, run as part of the full testsuite, 
creates a stub os.uname on an OS which doesn't support it natively.
However, it fails to restore it correctly -- ie fails to delete the
attribute. As a result, test_platform and test_pep352 fail when run
as a part of regrtest, since they rely on os.uname raising an
AttributeError on, eg, Windows.

Patch attached against r70302 of lib\distutils\tests\test_util.py

--
files: test_util.patch
keywords: patch
messages: 83449
nosy: tim.golden
severity: normal
status: open
title: distutils.test_util fails to restore os.uname
Added file: http://bugs.python.org/file13299/test_util.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5472
___Index: test_util.py
===
--- test_util.py(revision 70302)
+++ test_util.py(working copy)
@@ -51,7 +51,9 @@
 os.path.join = self.join
 os.path.isabs = self.isabs
 os.path.splitdrive = self.splitdrive
-if self.uname is not None:
+if self.uname is None:
+del os.uname
+else:
 os.uname = self.uname
 
 def _set_uname(self, uname):
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5473] round(float, ndigits0) sometimes rounds to odd

2009-03-10 Thread Christian Taylor

New submission from Christian Taylor di...@chello.at:

round(x, n) may unexpectedly round floats upwards to odd multiples of
10**(-n) if n is negative, depending on the system Python 3 is running
on. I think this is distinct from issue 1869.

Example:
 round(25.0, -1)
30.0

I used the following function to check 1000 cases for a given exponent
and yield the values where rounding to odd occurs:

def check(exponent):
factor = 10**exponent
for x in range(5, 5+2, 20):
if not round(float(x*factor), -1-exponent)  x*factor:
yield float(x*factor)

On a Core2 Duo running Arch Linux (32bit):
Python 3.1a1+ (py3k:70302, Mar 10 2009, 21:43:09)
[GCC 4.3.3] on linux2
Type help, copyright, credits or license for more information.
 [len(list(check(exponent))) for exponent in range(10)]
[1000, 1000, 1000, 1000, 1000, 0, 0, 1000, 1000, 1000]

On an Athlon XP running Slackware (32bit):
Python 3.1a1+ (py3k:70302, Mar 11 2009, 01:01:18)
[GCC 4.1.2] on linux2
Type help, copyright, credits or license for more information.
 [len(list(check(exponent))) for exponent in range(10)]
[1000, 1000, 1000, 1000, 1000, 0, 0, 1000, 1000, 1000]

On an Athlon 64 running Debian (32bit):
Python 3.1a1+ (py3k:70302, Mar 10 2009, 22:45:59)
[GCC 4.3.3] on linux2
Type help, copyright, credits or license for more information.
 [len(list(check(exponent))) for exponent in range(10)]
[0, 0, 0, 0, 630, 0, 0, 0, 195, 0]
 next(check(4))
65.0
 next(check(8))
145.0

--
components: Interpreter Core
messages: 83450
nosy: dingo
severity: normal
status: open
title: round(float, ndigits0) sometimes rounds to odd
type: behavior
versions: Python 3.0, Python 3.1

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



[issue3099] On windows, import nul always succeed

2009-03-10 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

Since I don't have access to Windows I am unassigning. Amaury, if this
is still a problem should we go ahead and switch to
GetFileAttributesEx()? Or just realize this is a problem for people
developing Python?

--
assignee: brett.cannon - 

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



[issue1538778] pyo's are not overwritten by different optimization levels

2009-03-10 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
assignee: brett.cannon - 

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



[issue1548371] filterwarnings('error') has no effect

2009-03-10 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

At this point the warnings module has been working as it is for so long
that this is not going to be able to change without a lot of pain for
people.

--
resolution:  - wont fix
status: open - closed

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



[issue2706] datetime: define division timedelta/timedelta

2009-03-10 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

On Tue, Mar 10, 2009 at 5:15 PM, Tennessee Leeuwenburg
rep...@bugs.python.org wrote:
..
 2) Allow divmod, the operator '%', to be applied to two timedeltas (e.g.
 td1 % td2). I think there is some debate here about whether the return
 value be an integer in microsends, or a timedelta. I personally believe
 that a timedelta should be returned, representing the amount of time
 remaining after (td1 // td2)  * td2 has been subtracted.

 The alternative is an integer, but due to a lack of immediate clarity
 over what time quanta this integer represents, I would suggest returning
 a unit amount. There is also some discussion of returning (long,
 timedelta), but I personally fail to see the merits of returning the
 long without some unit attached.


I don't think this alternative was ever seriously considered and no
patch was ever proposed to do it that way.  Victor's latest patch
implements divmod(timedelta, timedelta) - (int, timedelta) and
therefore timedelta % timedelta - timedelta.

--

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



[issue5474] distutils produces invalid RPM packages of prerelease python packages

2009-03-10 Thread Rudd-O

New submission from Rudd-O rud...@rudd-o.com:

Description of problem:

Building pre-release python distutils packages with python setup.py
bdist_rpm
works, but the version number is RPM-higher than the official release
package
that is released later.

This constitutes a problem because many of the components in major
Python apps
like Zope -- distributed as cheese shop eggs and downloadable via pip or
buildout -- are pre-release packages which, when turned into RPMs, contain
RPM-invalid version numbers.  The RPMs build, but the pre-release
packages are
considered newer by yum, so you can imagine the havoc that breaks.

How reproducible:

always


Steps to Reproduce:
1. python setup.py bdist_rpm
2. inspect version / release number of resulting RPMs, find out it's wrong
3. do not profit!

Actual results:

distutils package version: 1.4a
rpm package version: 1.4a


Expected results:

http://fedoraproject.org/wiki/Packaging/NamingGuidelines#Non-Numeric_Version_in_Release

Additional info:

patch attached.  works against python 2.4, may apply fine to python 2.5
or 2.6
too since distutils hasn't undergone that big of a rewrite.  

Ojo: the patch has been tested with distutils AND setuptools.

--
assignee: tarek
components: Distutils
files: distutils-bdist_rpm-prereleaseversion.patch
keywords: patch
messages: 83454
nosy: Rudd-O, tarek
severity: normal
status: open
title: distutils produces invalid RPM packages of prerelease python packages
versions: Python 2.4
Added file: 
http://bugs.python.org/file13300/distutils-bdist_rpm-prereleaseversion.patch

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



[issue5474] distutils produces invalid RPM packages of prerelease python packages

2009-03-10 Thread Rudd-O

Rudd-O rud...@rudd-o.com added the comment:

Heads up: The fix requires a patch (distributed with the python 2.4.x
RPM in CentOS) to be applied first.  I am attaching said patch so you
can apply the fix.

--

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



[issue5474] distutils produces invalid RPM packages of prerelease python packages

2009-03-10 Thread Rudd-O

Changes by Rudd-O rud...@rudd-o.com:


Added file: 
http://bugs.python.org/file13301/python-2.4-distutils-bdist-rpm.patch 
(prerequisite for the patch I wrote which is the prereleaseversion.patch)

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



[issue3652] Remove DeprecationWarning in _warnings about 'line'

2009-03-10 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

Applied in r70305 on trunk. Apparently I had already applied the patch
for py3k.

--
resolution:  - fixed
status: open - closed

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