Re: [Python-Dev] nonlocal x = value

2010-12-17 Thread Benjamin Peterson
2010/12/17 Stefan Behnel :
> Hi,
>
> it seems that Py3 doesn't support setting a "nonlocal" value as part of the
> "nonlocal" command
>
>    Python 3.2a4+ (py3k:86480, Nov 16 2010, 16:43:22)
>    [GCC 4.4.3] on linux2
>    Type "help", "copyright", "credits" or "license" for more information.
>    >>> def x():
>    ...   y = 5
>    ...   def f():
>    ...     nonlocal y = 6
>      File "", line 4
>        nonlocal y = 6
>                   ^
>    SyntaxError: invalid syntax
>
> even though the PEP clearly describes this feature.
>
> http://www.python.org/dev/peps/pep-3104/#proposed-solution
>
> Either the PEP or the implementation should be updated. Personally, I think
> the PEP should be changed as I think that the syntax complicates the grammar
> more than it's worth. Also, the moratorium applies here, given that Py3.1
> does not implement this.
>
> Comments?

There's a issue and a patch for this somewhere. I personally don't
care; it's not too painful to write two lines.



-- 
Regards,
Benjamin
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] nonlocal x = value

2010-12-17 Thread Laurens Van Houtven
+1 for throwing it out of the PEP. Assignment is a thing,
nonlocal/global is a thing, don't mix them up :) (That in addition to
the grammar cleanliness argument Stephan already made)

cheers
lvh.
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Summary of Python tracker Issues

2010-12-17 Thread Python tracker

ACTIVITY SUMMARY (2010-12-10 - 2010-12-17)
Python tracker at http://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
  open2537 (-20)
  closed 19971 (+72)
  total  22508 (+52)

Open issues with patches: 1070 


Issues opened (25)
==

#9232: Allow trailing comma in any function argument list.
http://bugs.python.org/issue9232  reopened by ncoghlan

#10642: Improve the error message of addpackage() (site.py) for defect
http://bugs.python.org/issue10642  reopened by r.david.murray

#10679: "make altinstall" may clobber OS provided scripts
http://bugs.python.org/issue10679  opened by ncoghlan

#10680: argparse: titles and add_mutually_exclusive_group don't mix (e
http://bugs.python.org/issue10680  opened by Mads.Michelsen

#10684: Shutil.move deletes file/folder in windows while renaming
http://bugs.python.org/issue10684  opened by harish

#10685: trace does nto ignore --ignore-module
http://bugs.python.org/issue10685  opened by RusiMody

#10686: email.Generator should use unknown-8bit encoded words for head
http://bugs.python.org/issue10686  opened by r.david.murray

#10690: IDLE Crash when running/saving Module
http://bugs.python.org/issue10690  opened by David_Anon

#10694: zipfile.py end of central directory detection not robust
http://bugs.python.org/issue10694  opened by KevinH

#10697: host and port attributes not documented well in function urlli
http://bugs.python.org/issue10697  opened by JTMoon79

#10701: Error pickling a dict
http://bugs.python.org/issue10701  opened by belopolsky

#10702: bytes and bytearray methods are not documented
http://bugs.python.org/issue10702  opened by belopolsky

#10708: Misc/porting should be folded in to the development FAQ
http://bugs.python.org/issue10708  opened by pitrou

#10709: Misc/AIX-NOTES needs updating
http://bugs.python.org/issue10709  opened by pitrou

#10711: Rip out HTTP 0.9 client support
http://bugs.python.org/issue10711  opened by pitrou

#10712: 2to3 fixer for deprecated unittest method names
http://bugs.python.org/issue10712  opened by ezio.melotti

#10713: re module doesn't describe string boundaries for \b
http://bugs.python.org/issue10713  opened by ralph.corderoy

#10715: uninformative error message
http://bugs.python.org/issue10715  opened by Phillip.M.Feldman

#10716: Modernize pydoc to use CSS
http://bugs.python.org/issue10716  opened by rhettinger

#10717: Multiprocessing module Pickling unPickling issues
http://bugs.python.org/issue10717  opened by dimitrios

#10720: test_threadsignals hang on FreeBSD 6.4
http://bugs.python.org/issue10720  opened by pitrou

#10721: Remove HTTP 0.9 server support
http://bugs.python.org/issue10721  opened by pitrou

#10722: IDLE's subprocess didnit make connection . Python 2.7
http://bugs.python.org/issue10722  opened by plovet

#10723: Undocumented built-in exceptions
http://bugs.python.org/issue10723  opened by flashk

#10725: Better cache instrumentation
http://bugs.python.org/issue10725  opened by rhettinger



Most recent 15 issues with no replies (15)
==

#10720: test_threadsignals hang on FreeBSD 6.4
http://bugs.python.org/issue10720

#10717: Multiprocessing module Pickling unPickling issues
http://bugs.python.org/issue10717

#10713: re module doesn't describe string boundaries for \b
http://bugs.python.org/issue10713

#10709: Misc/AIX-NOTES needs updating
http://bugs.python.org/issue10709

#10708: Misc/porting should be folded in to the development FAQ
http://bugs.python.org/issue10708

#10701: Error pickling a dict
http://bugs.python.org/issue10701

#10686: email.Generator should use unknown-8bit encoded words for head
http://bugs.python.org/issue10686

#10685: trace does nto ignore --ignore-module
http://bugs.python.org/issue10685

#10684: Shutil.move deletes file/folder in windows while renaming
http://bugs.python.org/issue10684

#10666: OS X installer variants have confusing readline differences
http://bugs.python.org/issue10666

#10664: xml.sax.expatreader should support namespace prefixes
http://bugs.python.org/issue10664

#10663: configure shouldn't set a default OPT
http://bugs.python.org/issue10663

#10657: os.lstat/os.stat/os.fstat don't set st_dev (st_rdev) on Window
http://bugs.python.org/issue10657

#10656: "Out of tree" build fails on AIX 5.3
http://bugs.python.org/issue10656

#10646: ntpath.samefile doesn't work for hard links
http://bugs.python.org/issue10646



Most recent 15 issues waiting for review (15)
=

#10725: Better cache instrumentation
http://bugs.python.org/issue10725

#10723: Undocumented built-in exceptions
http://bugs.python.org/issue10723

#10721: Remove HTTP 0.9 server support
http://bugs.python.org/issue10721

#10712: 2to3 fixer for deprecated unittest method names
http://bugs.python.org/issue10712

#10711: Rip out HTTP 0.9 client support
http://bugs.python.org

Re: [Python-Dev] nonlocal x = value

2010-12-17 Thread Alexander Belopolsky
On Fri, Dec 17, 2010 at 11:52 AM, Laurens Van Houtven  wrote:
> +1 for throwing it out of the PEP. Assignment is a thing,
> nonlocal/global is a thing, don't mix them up :) (That in addition to
> the grammar cleanliness argument Stephan already made)

Another +1 for the same reasons.  Also, since global does not allow
assignment, neither should nonlocal.
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] nonlocal x = value

2010-12-17 Thread Benjamin Peterson
2010/12/17 Alexander Belopolsky :
> On Fri, Dec 17, 2010 at 11:52 AM, Laurens Van Houtven  
> wrote:
>> +1 for throwing it out of the PEP. Assignment is a thing,
>> nonlocal/global is a thing, don't mix them up :) (That in addition to
>> the grammar cleanliness argument Stephan already made)
>
> Another +1 for the same reasons.  Also, since global does not allow
> assignment, neither should nonlocal.

Note that the PEP stated that global would also be extended.



-- 
Regards,
Benjamin
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] nonlocal x = value

2010-12-17 Thread Alexander Belopolsky
On Fri, Dec 17, 2010 at 12:33 PM, Benjamin Peterson  wrote:
..
>> Another +1 for the same reasons.  Also, since global does not allow
>> assignment, neither should nonlocal.
>
> Note that the PEP stated that global would also be extended.

I missed that, so for future reference, the PEP says:

"""
A shorthand form is also permitted, in which nonlocal is prepended to
an assignment or augmented assignment:

nonlocal x = 3
The above has exactly the same meaning as nonlocal x; x = 3. (Guido
supports a similar form of the global statement.)
"""

and refers to Guido's post at

http://mail.python.org/pipermail/python-3000/2006-November/004166.html

In any case, the relevant issue is

http://bugs.python.org/issue4199

and it should probably be marked as "after moratorium".  Meanwhile an
implementation status note can be added to the PEP to avoid this issue
being brought up again.
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Locale-specific formatting

2010-12-17 Thread MRAB

I had a thought about locale-specific formatting.

Currently, when we want to do locale-specific formatting we use the
locale module like this:

>>> locale.format("%d", 12345, grouping=False)
'12345'
>>> locale.format("%d", 12345, grouping=True)
'12,345'

This makes it harder to use more than one locale at a time, or one
which is different from the default.

My thought was that we could specify a locale in the format
specification mini-language and the parameter list of str.format,
something like this:

>>> loc = locale.getlocale()
>>> "{0:@1}".format(12345, loc)
'12345'
>>> "{0:,@1}".format(12345, loc)
'12,345'
...
>>> "UK says {value:,@uk} and France says 
{value:,@france}".format(value=12345, uk=uk_loc, france=france_loc)

'UK says 1,234.5 and France says 1 234,5'

Comments?
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Issue #8863 adds a new PYTHONNOFAULTHANDLER environment variable

2010-12-17 Thread Victor Stinner

Hi,

In 2008, I proposed a patch to raise a Python exception on SIGSEVG 
signal. In some cases, it's possible to catch the exception, log it, and 
continue the execution. But because in some cases, the Python internal 
state is corrupted, the idea was rejected (see the issue #3999).


Someone asked me to display the Python backtrace on SIGSEGV, instead of 
raising an exception. I implemented this idea in issue #8863. After 9 
versions, I think that the patch is ready for inclusion. It catchs 
SIGSEGV, SIGFPE, SIGBUS and SIGILL signals, and also display the Python 
backtrace on fatal errors. Because some operating systems have their own 
fault handler (eg. Ubuntu with apport), Dave Malcolm asked me to add an 
option disable the Python handler. That's why I added the 
PYTHONNOFAULTHANDLER environment variable (we all love long variable 
names!). For an OS vendor, it looks like an environment variable is more 
practical than a command line option. Eg. Mandriva sets 
PYTHONDONTWRITEBYTECODE for the whole system.


Raymond Hettinger asked me on IRC to write an email about the new 
environment variable, so here is the question: do you agree to add the 
new variable?


Victor
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Locale-specific formatting

2010-12-17 Thread R. David Murray
On Sat, 18 Dec 2010 00:08:47 +, MRAB  wrote:
> I had a thought about locale-specific formatting.
> 
> Currently, when we want to do locale-specific formatting we use the
> locale module like this:
> 
>  >>> locale.format("%d", 12345, grouping=False)
> '12345'
>  >>> locale.format("%d", 12345, grouping=True)
> '12,345'
> 
> This makes it harder to use more than one locale at a time, or one
> which is different from the default.
> 
> My thought was that we could specify a locale in the format
> specification mini-language and the parameter list of str.format,
> something like this:
> 
>  >>> loc = locale.getlocale()
>  >>> "{0:@1}".format(12345, loc)
> '12345'
>  >>> "{0:,@1}".format(12345, loc)
> '12,345'
> ...
>  >>> "UK says {value:,@uk} and France says 
> {value:,@france}".format(value=12345, uk=uk_loc, france=france_loc)
> 'UK says 1,234.5 and France says 1 234,5'
> 
> Comments?

There was at least one long thread on this on python-ideas.  Probably
worth finding and reading before proceeding with a new discussion... :)

I think it was part of the discussion that ultimately led to PEP 378.

--
R. David Murray  www.bitdance.com
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com