Re: [Python-Dev] Improve error message "UnboundLocalError: local variable referenced before assignment"

2012-10-31 Thread Terry Reedy
On 10/31/2012 9:20 PM, Terry Reedy wrote: On 10/31/2012 4:28 PM, R. David Murray wrote: "local variable referenced before assignment" *is* a pointer to the concept of when global variables become local...perhaps there is a better wording, do you have a suggestion? The current wording is an exa

Re: [Python-Dev] Improve error message "UnboundLocalError: local variable referenced before assignment"

2012-10-31 Thread Chris Angelico
On Thu, Nov 1, 2012 at 12:20 PM, Terry Reedy wrote: > The current wording is an exact, concise, description of the problem. Rather > than tinkering with the wording, I think a more general solution might be a > new HOWTO: Understanding exception messages. It could have alphabetically > sorted entr

Re: [Python-Dev] Improve error message "UnboundLocalError: local variable referenced before assignment"

2012-10-31 Thread Terry Reedy
On 10/31/2012 4:28 PM, R. David Murray wrote: "local variable referenced before assignment" *is* a pointer to the concept of when global variables become local...perhaps there is a better wording, do you have a suggestion? The current wording is an exact, concise, description of the problem. R

Re: [Python-Dev] Improve error message "UnboundLocalError: local variable referenced before assignment"

2012-10-31 Thread Steven D'Aprano
On 01/11/12 06:57, anatoly techtonik wrote: [...] UnboundLocalError: local variable 'FONT_NAMES' referenced before assignment As you may see there is inconsistency between handling of line 6 - "if len(DEBUG):" and line 8 - "if len(FONT_NAMES):". This is very magical and hard to troubleshoot.

Re: [Python-Dev] [Python-checkins] cpython: Issue #15478: Fix test_os on Windows (os.chown is missing)

2012-10-31 Thread Victor Stinner
Hi, 2012/10/31 Jeremy Kloth : > On Tue, Oct 30, 2012 at 6:07 PM, victor.stinner > wrote: >> http://hg.python.org/cpython/rev/01cc9fb52887 >> changeset: 80068:01cc9fb52887 >> user:Victor Stinner >> date:Wed Oct 31 01:04:10 2012 +0100 >> summary: >> Issue #15478: Fix test_os on

Re: [Python-Dev] Improve error message "UnboundLocalError: local variable referenced before assignment"

2012-10-31 Thread Terry Reedy
This post would have been more appropriate on python-list than python-dev. But to answer your implied questions... On 10/31/2012 3:57 PM, anatoly techtonik wrote: Here is the code: ---[cut]- DEBUG = [] FONT_NAMES = [] This line has nothing to do with the behavior

Re: [Python-Dev] Sign of bytes

2012-10-31 Thread Amaury Forgeot d'Arc
2012/10/31 anatoly techtonik : > I wonder why Python uses signed chars for bytes > http://docs.python.org/2/library/ctypes.html#ctypes.c_byte c_int is signed, c_uint is unsigned. similarly c_byte is signed, and c_ubyte is unsigned. > Windows implements BYTE as unsigned char, and it is in the same

Re: [Python-Dev] Improve error message "UnboundLocalError: local variable referenced before assignment"

2012-10-31 Thread R. David Murray
On Wed, 31 Oct 2012 21:57:28 +0200, anatoly techtonik wrote: > Here is the code: > > ---[cut]- > > DEBUG = [] > FONT_NAMES = [] > > def names(): > if len(DEBUG): > print(len(DEBUG)) > if len(FONT_NAMES): > print(len(FONT_NAMES)) > if len(FONT_NAMES)==0

[Python-Dev] Improve error message "UnboundLocalError: local variable referenced before assignment"

2012-10-31 Thread anatoly techtonik
Here is the code: ---[cut]- DEBUG = [] FONT_NAMES = [] def names(): if len(DEBUG): print(len(DEBUG)) if len(FONT_NAMES): print(len(FONT_NAMES)) if len(FONT_NAMES)==0: FONT_NAMES = "query()" names() ---[cut]- Here is the

Re: [Python-Dev] Sign of bytes

2012-10-31 Thread Xavier Morel
On 2012-10-31, at 18:44 , anatoly techtonik wrote: > I wonder why Python uses signed chars for bytes > http://docs.python.org/2/library/ctypes.html#ctypes.c_byte That's not Python, that's ctypes. struct[0] has no "bytes" it uses "char" for everything. If I had to guess, it would be because "char"

Re: [Python-Dev] Sign of bytes

2012-10-31 Thread anatoly techtonik
The thing that made me wonder is here - http://bugs.python.org/issue16376 When I inspect contents of Windows structures, I get negative values that are not present in MSDN. -- anatoly t. On Wed, Oct 31, 2012 at 7:44 PM, anatoly techtonik wrote: > Hi, > > I wonder why Python uses signed chars f

[Python-Dev] Sign of bytes

2012-10-31 Thread anatoly techtonik
Hi, I wonder why Python uses signed chars for bytes http://docs.python.org/2/library/ctypes.html#ctypes.c_byte This is a Java thing, but Java doesn't have unsigned types at all http://en.wikipedia.org/wiki/Criticism_of_Java#Unsigned_integer_types Windows implements BYTE as unsigned char, and it

Re: [Python-Dev] Segmentaion fault with wrongly set PYTHONPATH on Windows

2012-10-31 Thread anatoly techtonik
On Tue, Oct 23, 2012 at 2:39 AM, Stephen J. Turnbull < turnb...@sk.tsukuba.ac.jp> wrote: > > So it shuts down abnormally. That's what an abort means, in > programming as in rocket launches. Users should be scared if this > happens; somebody really screwed up. (Unless it's themselves, and > then

Re: [Python-Dev] [Python-checkins] cpython: Issue #15478: Fix test_os on Windows (os.chown is missing)

2012-10-31 Thread Jeremy Kloth
On Tue, Oct 30, 2012 at 6:07 PM, victor.stinner wrote: > http://hg.python.org/cpython/rev/01cc9fb52887 > changeset: 80068:01cc9fb52887 > user:Victor Stinner > date:Wed Oct 31 01:04:10 2012 +0100 > summary: > Issue #15478: Fix test_os on Windows (os.chown is missing) > > files:

Re: [Python-Dev] accept the wheel PEPs 425, 426, 427

2012-10-31 Thread Ronald Oussoren
On 31 Oct, 2012, at 13:38, Daniel Holth wrote: > On Wed, Oct 24, 2012 at 7:04 AM, Ronald Oussoren > wrote: >> >> On 18 Oct, 2012, at 19:29, Daniel Holth wrote: >> >>> I'd like to submit the Wheel PEPs 425 (filename metadata), 426 >>> (Metadata 1.3), and 427 (wheel itself) for acceptance. Th

Re: [Python-Dev] accept the wheel PEPs 425, 426, 427

2012-10-31 Thread Daniel Holth
On Wed, Oct 24, 2012 at 7:04 AM, Ronald Oussoren wrote: > > On 18 Oct, 2012, at 19:29, Daniel Holth wrote: > >> I'd like to submit the Wheel PEPs 425 (filename metadata), 426 >> (Metadata 1.3), and 427 (wheel itself) for acceptance. The format has >> been stable since May and we are preparing a p