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

2009-03-14 Thread Eric Smith

Changes by Eric Smith e...@trueblade.com:


Removed file: http://bugs.python.org/file13283/half-baked-not-for-real-use.patch

___
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



[issue5487] Parts of Tkinter missing (but not when running from IDLE)

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

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

Why do you think this is a bug? You need to import tkinter.messagebox
explicitly for your program to be correct. That you could do without
inside IDLE is only because IDLE had already imported that module.

Closing as won't fix.

--
nosy: +loewis
resolution:  - wont fix
status: open - closed

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



[issue5479] Add an easy way to provide total ordering now that __cmp__ is deprecated/gone

2009-03-14 Thread Mart Sõmermaa

Mart Sõmermaa m...@mrts.pri.ee added the comment:

 This is the 2.6 version. What about the 3.0 version in
 http://docs.python.org/3.0/reference/datamodel.html#object.__lt__
 needs to be updated?

When functools.total_ordering (whether it lands in functools is open)
lands that section should be amended in the lines of the following:

There are no implied relationships among the comparison operators. The
truth of x==y does not imply that x!=y is false. Accordingly, when
defining __eq__(), one should also define __ne__() so that the operators
will behave as expected.

However, given a class defining one or more ordering methods,
`functools.total_ordering`_ class decorator can be used to fill in the
rest. Please see the documentation of `functools.total_ordering`_ for
further details.

--

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



[issue5482] RFC: improve distutils bdist_rpm so it builds pure python modules as single packages that works across architectures

2009-03-14 Thread Rudd-O

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

More info:

From my wicked noarch RPM compiled in an i386 machine, installed into my
64 bit centos (same OS):

[rud...@tobey ~]$ python
Python 2.4.5 (#1, Mar 13 2009, 12:13:36)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Type help, copyright, credits or license for more information.
 import wicked
 wicked.__file__
'/usr/lib/site-python/wicked/__init__.pyc'

Evidence that the compiled file is being not recompiled, and is being
used directly on import, even across architectures.

-

However, I have discovered that I cannot run the same pyc file across
interpreters, even though the py file would run, so I am stumped at
this.  The reason i am stumped is that I can find a
platform-independent, interpreter-independent dir (site-python), and a
platform-dependent, interpreter-dependent dir (site-packages), but NOT a
platform-independent, interpreter-dependent dir, which is the BIG issue
here if we want to at least avoid having to rebuild python packages for
different architectures with the SAME interpreter.

Ideas?  I am thirsty for more knowledge here and losing hope.

--

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



[issue5482] RFC: improve distutils bdist_rpm so it builds pure python modules as single packages that works across architectures

2009-03-14 Thread Rudd-O

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

apparently, /usr/lib/python2.4/site-packages IS in the sys.path, which
would seem to indicate that python would actually load pure python
modules from there.

Which means that the only fixes that need to go within distutils would be:

1. a fix so in 64bit arches, pure python modules are STILL INSTALLED
within the /usr/lib/python2.X dir instead of lib64
2. making every RPM built out of a pure python module depend on the
specific Python interpreter it was built under, to a precision of
major.minor version.

Right?

This sort of busts my plan of providing universal RPM packages for all
distributions, BUT... BUT... at least means that a single package can
work in all platforms of all distributions that have a particular
version of the interpreter it was built in.  Which is a space / busywork
savings of at least platforms*distributions.

--

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



[issue5482] RFC: improve distutils bdist_rpm so it builds pure python modules as single packages that works across architectures

2009-03-14 Thread Rudd-O

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

last comment, first line, I should amend it to say that even in 64bit
arches, the /usr/lib (NOT ilb64) sitepackages dir is available.

I would have to actually try this on the packages that I have, see how i
fare.

--

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



[issue5482] RFC: improve distutils bdist_rpm so it builds pure python modules as single packages that works across architectures

2009-03-14 Thread Rudd-O

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

FYI: In RPM, the correct dependency to require a particulr python minor
version is:

python(abi) = 2.X

where X is the minor version.

--

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



[issue1568] PATCH: Armin's attribute lookup caching for 3.0

2009-03-14 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

I'm not sure this should be closed. According to Neil (see above) the 
implementation could be simpler in 3.0

--

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



[issue4281] Idle - incorrectly displaying a character (Latin capital letter sharp s)

2009-03-14 Thread Vlastimil Brom

Vlastimil Brom vlastimil.b...@gmail.com added the comment:

I just wanted to confirm, that there isn't a bug in idle nor tk, but 
somwhere in my istalled fonts.
Now while testing python 3.1a1, when I also have a font containing ẞ 
LATIN CAPITAL LETTER SHARP S (DejaVu), it's more clear.
Printing this character using a default font in idle I get the wrong 
glyph mentioned in the report; however this is corrected immediately 
after changing the font to DejaVu.
Some of the fonts on my system seems to shadow this newly added 
character with a wrong glyph (also preventing tk to find a font realy 
suporting this).

Sorry for the needles bug report.
   vbr

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4281
___
___
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-14 Thread Mark Dickinson

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

The latest patch looks good to me, and results in a much cleaner looking 
_struct.c.  Thank you!

One worry: the issue 4228 discussion suggests that the zipfile module 
still relies on the deprecated wrapping.  I think this needs to be 
investigated (and fixed if necessary) before this patch can be applied.

--

___
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



[issue1568] PATCH: Armin's attribute lookup caching for 3.0

2009-03-14 Thread Antoine Pitrou

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

Ok, reopening and retargetting to 3.1 in case someone wants to work on it.

--
resolution: fixed - accepted
stage:  - patch review
status: closed - open
type: feature request - performance
versions: +Python 3.1 -Python 3.0

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1568
___
___
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-14 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

Committed:
r70364 (trunk)
r70366 (py3k)

The docs still need updating. If anyone with more knowledge of the
documentation system than I have would like to tackle those, please feel
free!

--
priority:  - high
resolution:  - accepted

___
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



[issue4228] struct.pack('L', -1)

2009-03-14 Thread Mark Dickinson

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

Was zipfile ever fixed to avoid this deprecated behaviour?  If not, is the 
fix fairly trivial?

It would be nice to be able to finally turn these struct deprecation 
warnings into errors in Python 3.1 and/or Python 2.7.

--
nosy: +marketdickinson

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



[issue1714448] if something as x:

2009-03-14 Thread Jervis Whitley

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

Hi, 

I like this idea. 

I've put together a short patch that will implement inline
assignment. 

if f() - name:
  use(name)

or more powerfully:

if f() - name == 'spam':
   usespam(name)

the old syntax if something as x: is still available if that
is what is desired.

if (f() == 'spam') - name:
   newname = name.replace('p', 'h') 

Patched against Py3k please kick the tires, I've added some tests and
developed a PEP.

--
keywords: +patch
nosy: +jdwhitley
versions: +Python 3.1 -Python 2.6
Added file: http://bugs.python.org/file13329/assexp.diff

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



[issue5251] contextlib.nested inconsistent with, well, nested with statements due exceptions raised in __enter__

2009-03-14 Thread Nick Coghlan

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

First draft of patch attached.

Limitations of this version of the patch:
- includes some unrelated marshal.c changes (improved error messages)
- no tests of the new functionality
- contextlib not changed yet
- no documentation changes

The new semantics are in place though, and the existing test_with and
test_contextlib tests all still pass.

--
keywords: +patch
Added file: http://bugs.python.org/file13330/pep377_v1.diff

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



[issue1143] Update to latest ElementTree in Python 2.7

2009-03-14 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

Well, sure, but I'm not going to do it. :)

--

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



[issue1143] Update to latest ElementTree in Python 2.7

2009-03-14 Thread Antoine Pitrou

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

I was silently suggesting that you could add it to the release PEP :-)

--

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



[issue1143] Update to latest ElementTree in Python 2.7

2009-03-14 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

2009/3/14 Antoine Pitrou rep...@bugs.python.org:

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

 I was silently suggesting that you could add it to the release PEP :-)

Wow, I'm really not getting the subtle hints today.

--

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



[issue4688] GC optimization: don't track simple tuples and dicts

2009-03-14 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


Removed file: http://bugs.python.org/file12387/tupleopts.patch

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



[issue4688] GC optimization: don't track simple tuples and dicts

2009-03-14 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


Removed file: http://bugs.python.org/file12389/dictopts2.patch

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



[issue4688] GC optimization: don't track simple tuples and dicts

2009-03-14 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


Removed file: http://bugs.python.org/file12396/tupleopts-alt.patch

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



[issue4688] GC optimization: don't track simple tuples and dicts

2009-03-14 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


Removed file: http://bugs.python.org/file12397/tuple+dictopts-alt.patch

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



[issue4688] GC optimization: don't track simple tuples and dicts

2009-03-14 Thread Antoine Pitrou

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

Here is a new patch against trunk.

--
Added file: http://bugs.python.org/file13331/containeropts.patch

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



[issue5482] RFC: improve distutils bdist_rpm so it builds pure python modules as single packages that works across architectures

2009-03-14 Thread Rudd-O

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

Apropos this bug, the issues are fleshed out here:

http://rudd-o.com/new-projects/python-improvements/how-to-slash-man-years-from-the-process-of-building-rpms-out-of-python-modules

--

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



[issue4688] GC optimization: don't track simple tuples and dicts

2009-03-14 Thread Antoine Pitrou

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

Here is a benchmark ripped from the Computer Language Shootout
(http://shootout.alioth.debian.org).
Running binary_trees.py 18 takes the following time:
- without patch: 330s.
- with patch:201s. (40% speedup)
- with GC disabled : 165s.

Running pybench --with-gc doesn't show any performance variation, which
seems to imply the overhead of the heuristic is negligible.

--
Added file: http://bugs.python.org/file13332/binary-trees.py

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



[issue5488] nb_inplace_divide slot is missing in docs

2009-03-14 Thread Lorenz Quack

New submission from Lorenz Quack d...@amberfisharts.com:

http://docs.python.org/c-api/typeobj.html#PyNumberMethods lists the
slots in the PyNumberMethods struct used to implement the Number
Protocol for extension types.

The entry for binaryfunc nb_inplace_divide; is missing from this listing.
It belongs between binaryfunc nb_inplace_multiply; and binaryfunc
nb_inplace_remainder;

There is a patch against r70371 of the trunk attached.

--
assignee: georg.brandl
components: Documentation
files: typeobj.rst.patch
keywords: patch
messages: 83595
nosy: donlorenzo, georg.brandl
severity: normal
status: open
title: nb_inplace_divide slot is missing in docs
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1
Added file: http://bugs.python.org/file1/typeobj.rst.patch

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



[issue5489] Broken DLL

2009-03-14 Thread JCoder

New submission from JCoder bcookma...@gmail.com:

The windows installer for Python 2.6 failed to install Python on 
Windows ME because a DLL required for installation could not be run.

--
components: Installation
messages: 83596
nosy: JCoder
severity: normal
status: open
title: Broken DLL
type: behavior
versions: Python 2.6

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



[issue2874] Remove use of the stat module in the stdlib

2009-03-14 Thread Brett Cannon

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

We never came to an agreement on how to handle this so it's just been
sitting here.

--

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



[issue5489] Broken DLL

2009-03-14 Thread Hirokazu Yamamoto

Hirokazu Yamamoto ocean-c...@m2.ccsnet.ne.jp added the comment:

The support for Win9x,Me,NT4 was dropped from python2.6. See
http://www.python.org/dev/peps/pep-0011/

--
nosy: +ocean-city
resolution:  - wont fix
status: open - closed

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



[issue5490] Broken DLL

2009-03-14 Thread JCoder

New submission from JCoder bcookma...@gmail.com:

When I try to install Python 2.6 on Windows ME, I get an error message 
saying that a DLL file needed to install it cannot be opened.

By the way, I just posted this message, and apparantly, it disappeared.

--
components: Installation
messages: 83599
nosy: JCoder
severity: normal
status: open
title: Broken DLL
type: behavior
versions: Python 2.6

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



[issue5490] Broken DLL

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

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

This is a duplicate of issue 5490.

--
nosy: +loewis
resolution:  - duplicate
status: open - closed
superseder:  - Broken DLL

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



[issue1700507] Carbon.Scrap.PutScrapFlavor

2009-03-14 Thread Garrett Cooper

Garrett Cooper yaneg...@gmail.com added the comment:

I'm confirming this issue on Intel / Leopard with python 2.5 (system
python), 2.5 (macports) and 2.6 (macports).

PPC / Tiger with python 2.3 (system python), 2.5 (macports) and 2.6
(macports) just errors out with:

MacOS.Error: (-4960, 'coreFoundationUnknownErr')

--
nosy: +yaneurabeya

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



[issue1700507] Carbon.Scrap.PutScrapFlavor

2009-03-14 Thread Garrett Cooper

Garrett Cooper yaneg...@gmail.com added the comment:

The failure testcase that dingus9 provided is:

import Carbon.Scrap as Scrap
scrap = Scrap.GetCurrentScrap()
scrap.GetScrapFlavorData('TEXT')

--

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



[issue1700507] Carbon.Scrap.PutScrapFlavor

2009-03-14 Thread Garrett Cooper

Changes by Garrett Cooper yaneg...@gmail.com:


--
versions: +Python 2.4, Python 2.5

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



[issue1700507] Carbon.Scrap.PutScrapFlavor

2009-03-14 Thread Garrett Cooper

Changes by Garrett Cooper yaneg...@gmail.com:


--
versions:  -Python 2.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1700507
___
___
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-14 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

Either Brandl or Peterson can and typically will change the .rst source
if given the exact new text.  For me to write that, I need to know the
grammar you actually implemented.  Did you, in essence, simply change

field_name::=  (identifier | integer) (. attribute_name | [
element_index ])*

to (in essence)

field_name::=  (identifier | integer | ) (. attribute_name |
[ element_index ])*

with the proviso that integers and blanks not be mixed in the same
string, so that{.attr} and {[dex]} become legal?  Or are those still
illegal because only totally blank field names are allowed, so that the
new field_name rule is essentially

field_name::=  ((identifier | integer) (. attribute_name | [
element_index ])*) | ( )

(with the same proviso).

The existing doc text after the grammar box is slightly ambiguous or
contradictory in that it first says that field names *are* ints or names
and then says, correctly, that they *begin* with an int or name. (I
would like to fix this in addition to adding a sentence.) Hence 'blank
field name' can have two slightly different meanings and hence the
question above.

--

___
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-14 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

I implemented this one:
field_name::=  (identifier | integer | ) (. attribute_name |
[ element_index ])*

Which I would have written as:
field_name::=  (identifier | integer)? (. attribute_name |
[ element_index ])*

Not that it matters, of course.

And the proviso is correct: blanks and integers cannot be mixed in the
same string.

Thanks for looking at this!

--
stage:  - committed/rejected

___
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



[issue2116] weakref copy module interaction

2009-03-14 Thread Antoine Pitrou

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

Should a deepcopy of a weakref return the same weakref, or a weakref to
a new copied object?
Also, what about the optional callback?

--
nosy: +pitrou

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



[issue2116] weakref copy module interaction

2009-03-14 Thread Antoine Pitrou

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

Hmm, forget that question. If we deepcopy the weakref target, it will be
destroyed just afterwards, making the deepcopied weakref useless.

--

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



[issue2116] weakref copy module interaction

2009-03-14 Thread Antoine Pitrou

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

Here is a patch providing proper copy and deepcopy support, including
for weak dicts (the Proxy type is unsupported, though).

--
Added file: http://bugs.python.org/file13334/issue2116.patch

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



[issue1714448] if something as x:

2009-03-14 Thread Steven D'Aprano

Steven D'Aprano st...@pearwood.info added the comment:

Regarding the proposed syntax:

if (f() == 'spam') - name:
   newname = name.replace('p', 'h') 

Surely that should assign the *bool* result of comparing f() 
with 'spam' to name? Doing anything else is opening the door to a 
world of pain.

if (f() == 'spam') - name  # binds name=f()
if ('spam' == f()) - name  # binds 'spam' to name?
if (f() == g()) - name  # binds what to name?
if (f() or g()) - name  # binds what to name?

--

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



[issue1714448] if something as x:

2009-03-14 Thread Jervis Whitley

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

 If we allow this, how many of the following will be allowed?

 if expr as name: block
 while expr as name: block
 expr as name  # alternative to name = expr

This patch implements your final point:
 expr as name (albeit with a nominal '-' RARROW rather than 'as')

the patch creates a new expression, assexp (assignment expression) 
there is no need to implement this for countless other 
if/while/for because
they accept expressions and this assignment is an expression.
(Note it is a patch for a different behaviour than the OP suggested.)


 As for using -, please no, there are plenty of languages that use 
 line noise, but Python doesn't need to be one of them.

I have begun a discussion about this on python-ideas to give it some
air as suggested by Raymond. We can always close the issue as 'wont fix'
if it doesn't get off the ground. 

This issue (although addressing an old concern dating back 
to the beginning of python) has been sitting unloved for 9 or so months
and I felt that we should at least resolve it.

Cheers, 

Jervis

--

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



[issue2116] weakref copy module interaction

2009-03-14 Thread Antoine Pitrou

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

Updated patch so that copied weakdicts are decoupled (adding an item to
the copy doesn't mutate the original).

--
Added file: http://bugs.python.org/file13335/issue2116-2.patch

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



[issue1714448] if something as x:

2009-03-14 Thread Jervis Whitley

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

 Regarding the proposed syntax:

 if (f() == 'spam') - name:
   newname = name.replace('p', 'h') 

 Surely that should assign the *bool* result of comparing f() 
 with 'spam' to name? Doing anything else is opening the door to a 
 world of pain.

You are correct. It does assign the result of the bool. I have
made an error in creating the example. This is what happens when
I copy and paste and don't check the result.

should read

 if f - name:
   # use name, (pointless example but in line with the OP's suggestion)

Thanks for picking this up.

--

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



[issue1714448] if something as x:

2009-03-14 Thread Matthew Barnett

Matthew Barnett pyt...@mrabarnett.plus.com added the comment:

At the moment binding occurs either right-to-left with =, eg.

x = y

where x is the new name, or left-to-right, eg.

import x as y

where y is the new name.

If the order is to be right-to-left then using as seems to be the best
choice.

On the other hand, if there should be a form of binding explicitly for
use in an expression in order to prevent accidental use of = then the
order should probably be the same as =, ie right-to-left, and a new
symbol is needed (using punctuation feels preferable somehow, because
= uses punctuation).

The only symbol I can think of is ~=.

How does this:

if ob ~= map[x][y].overpay:
   ob.blit(x, y)

look compared to:

if map[x][y].overpay as ob:
   ob.blit(x, y)

IMHO, of course.

--
nosy: +mrabarnett

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



[issue5251] contextlib.nested inconsistent with, well, nested with statements due exceptions raised in __enter__

2009-03-14 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


Removed file: http://bugs.python.org/file13330/pep377_v1.diff

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



[issue5251] contextlib.nested inconsistent with, well, nested with statements due exceptions raised in __enter__

2009-03-14 Thread Nick Coghlan

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

Removed first draft of patch - it was fundamentally flawed (it didn't
clean up the stack properly when the statement body was skipped)

--

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



[issue5251] contextlib.nested inconsistent with, well, nested with statements due exceptions raised in __enter__

2009-03-14 Thread Nick Coghlan

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

Second draft attached, this time with tests and sans segmentation faults :)

Limitations of this version of the patch:
- still includes some unrelated marshal.c changes (improved error messages)
- no documentation changes yet

--
Added file: http://bugs.python.org/file13336/pep377_v2.diff

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



[issue5251] contextlib.nested inconsistent with, well, nested with statements due exceptions raised in __enter__

2009-03-14 Thread Nick Coghlan

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

Note that the semantics in the current patch aren't quite correct, since
the __exit__ attribute is retrieved inside the scope of the outer
try/except block. Updated patch with the correct semantics coming soon.

--

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



[issue1714448] if something as x:

2009-03-14 Thread Steven D'Aprano

Steven D'Aprano st...@pearwood.info added the comment:

Matthew suggested ~= instead of - or as.

I dislike this because ~= first makes me think of approximately equal 
to, and then it makes me think of augmented assignment, and only then 
do I remember that although ~ is used in Python for bitwise-not, ~= is 
not a legal augmented assignment.

--

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



[issue5491] Clarify contextlib.nested semantics

2009-03-14 Thread Nick Coghlan

New submission from Nick Coghlan ncogh...@gmail.com:

Current doc example:

with nested(A, B, C) as (X, Y, Z):
do_something()

with A as X:
with B as Y:
with C as Z:
do_something()

Recommended docs change:

with nested(A(), B(), C()) as (X, Y, Z):
do_something()

m1, m2, m3 = A(), B(), C()
with m1 as X:
with m2 as Y:
with m3 as Z:
do_something()

This makes it clearer that when using nested, the context managers are
all created outside the scope of the with statement.

--
assignee: georg.brandl
components: Documentation
messages: 83619
nosy: georg.brandl, ncoghlan
severity: normal
status: open
title: Clarify contextlib.nested semantics

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