Re: [Python-Dev] Submitting PEP 422 (Simple class initialization hook) for pronouncement

2013-02-11 Thread Nick Coghlan
On Tue, Feb 12, 2013 at 8:35 AM, Guido van Rossum wrote: > On Mon, Feb 11, 2013 at 2:29 PM, Nick Coghlan wrote: >> 4.__class__ is already bound as soon as we have a class object to bind it >> to, so we can't move it any earlier. However, it's already early enough to >> let references to it from t

Re: [Python-Dev] Submitting PEP 422 (Simple class initialization hook) for pronouncement

2013-02-11 Thread Steven D'Aprano
On 12/02/13 10:56, Jan Kaliszewski wrote: Wouldn't __initclass__ be readable enough? IMHO it could spare users trouble with remembering special case. +1 I approve of the colour of this bikeshed. __init_class__ has too many underscores. -- Steven _

Re: [Python-Dev] Submitting PEP 422 (Simple class initialization hook) for pronouncement

2013-02-11 Thread Jan Kaliszewski
11.02.2013 23:29, Nick Coghlan wrote: 3. I'm trying to avoid any custom magic specific to this method, but making it implicitly a static or class method is fairly easy if we so choose - the standard retrieval code during class creation can just bypass the descriptor machinery, and wrap it in sta

Re: [Python-Dev] Submitting PEP 422 (Simple class initialization hook) for pronouncement

2013-02-11 Thread Guido van Rossum
On Mon, Feb 11, 2013 at 2:29 PM, Nick Coghlan wrote: > > On 12 Feb 2013 07:44, "Guido van Rossum" wrote: > > > > On Mon, Feb 11, 2013 at 12:57 PM, PJ Eby wrote: > >> > >> On Mon, Feb 11, 2013 at 12:44 PM, Guido van Rossum > wrote: > >> > Hi Nick, > >> > > >> > I think this will make a fine add

Re: [Python-Dev] Submitting PEP 422 (Simple class initialization hook) for pronouncement

2013-02-11 Thread Nick Coghlan
On 12 Feb 2013 07:44, "Guido van Rossum" wrote: > > On Mon, Feb 11, 2013 at 12:57 PM, PJ Eby wrote: >> >> On Mon, Feb 11, 2013 at 12:44 PM, Guido van Rossum wrote: >> > Hi Nick, >> > >> > I think this will make a fine addition to the language. I agree that >> > it is superior to the alternatives

Re: [Python-Dev] Submitting PEP 422 (Simple class initialization hook) for pronouncement

2013-02-11 Thread Guido van Rossum
On Mon, Feb 11, 2013 at 12:57 PM, PJ Eby wrote: > On Mon, Feb 11, 2013 at 12:44 PM, Guido van Rossum > wrote: > > Hi Nick, > > > > I think this will make a fine addition to the language. I agree that > > it is superior to the alternatives and fulfills a real (if rare) need. > > > > I only have a

Re: [Python-Dev] Submitting PEP 422 (Simple class initialization hook) for pronouncement

2013-02-11 Thread PJ Eby
On Mon, Feb 11, 2013 at 12:44 PM, Guido van Rossum wrote: > Hi Nick, > > I think this will make a fine addition to the language. I agree that > it is superior to the alternatives and fulfills a real (if rare) need. > > I only have a few nits/questions/suggestions. > > - With PJE, I think __init_cl

Re: [Python-Dev] My CLA

2013-02-11 Thread Jesse Noller
On Monday, February 11, 2013 at 2:23 PM, Antoine Pitrou wrote: > On Mon, 11 Feb 2013 22:07:50 +0300 > anatoly techtonik mailto:techto...@gmail.com)> wrote: > > On Mon, Feb 11, 2013 at 9:27 PM, Guido van Rossum > (mailto:gu...@python.org)> wrote: > > > > > Anatoly, stop this discussion *NOW*. I

Re: [Python-Dev] My CLA

2013-02-11 Thread Antoine Pitrou
On Mon, 11 Feb 2013 22:07:50 +0300 anatoly techtonik wrote: > On Mon, Feb 11, 2013 at 9:27 PM, Guido van Rossum wrote: > > > Anatoly, stop this discussion *NOW*. It is not appropriate for python-dev > > and you risk being banned from python-dev if you keep it up. > > > > It is not a problem for

Re: [Python-Dev] My CLA

2013-02-11 Thread anatoly techtonik
On Mon, Feb 11, 2013 at 9:27 PM, Guido van Rossum wrote: > Anatoly, stop this discussion *NOW*. It is not appropriate for python-dev > and you risk being banned from python-dev if you keep it up. > It is not a problem for me to keep silence for another couple of months. But this weekend there wi

Re: [Python-Dev] Question regarding: Lib/_markupbase.py

2013-02-11 Thread Guido van Rossum
Warning: see http://bugs.python.org/issue17170. Depending on the length of the string being scanned and the probability of finding the specific character, the proposed change could actually be a *pessimization*. OTOH if the character occurs many times, the slice will actually cause O(N**2) behavior

Re: [Python-Dev] My CLA

2013-02-11 Thread Brian Curtin
On Mon, Feb 11, 2013 at 12:30 PM, Oleg Broytman wrote: > On Mon, Feb 11, 2013 at 09:18:58PM +0300, anatoly techtonik > wrote: >> On Mon, Feb 11, 2013 at 4:01 PM, Oleg Broytman wrote: >> >> > On Mon, Feb 11, 2013 at 03:49:39PM +0300, anatoly techtonik < >> > techto...@gmail.com> wrote: >> > > Py

Re: [Python-Dev] Question regarding: Lib/_markupbase.py

2013-02-11 Thread Oleg Broytman
On Mon, Feb 11, 2013 at 12:16:48PM +, Developer Developer wrote: > I was having a look at the file: Lib/_markupbase.py (@ 82151), function: > "_parse_doctype_element" and have seen something that has caught my attention: > > if '>' in rawdata[j:]: >     return rawdata.find(">", j) + 1 > >

Re: [Python-Dev] My CLA

2013-02-11 Thread Oleg Broytman
On Mon, Feb 11, 2013 at 09:18:58PM +0300, anatoly techtonik wrote: > On Mon, Feb 11, 2013 at 4:01 PM, Oleg Broytman wrote: > > > On Mon, Feb 11, 2013 at 03:49:39PM +0300, anatoly techtonik < > > techto...@gmail.com> wrote: > > > Python Contributor Agreement > > > >

Re: [Python-Dev] My CLA

2013-02-11 Thread Guido van Rossum
Anatoly, stop this discussion *NOW*. It is not appropriate for python-dev and you risk being banned from python-dev if you keep it up. On Mon, Feb 11, 2013 at 10:18 AM, anatoly techtonik wrote: > On Mon, Feb 11, 2013 at 4:01 PM, Oleg Broytman wrote: > >> On Mon, Feb 11, 2013 at 03:49:39PM +0300

Re: [Python-Dev] My CLA

2013-02-11 Thread Amaury Forgeot d'Arc
2013/2/11 anatoly techtonik > On Mon, Feb 11, 2013 at 4:01 PM, Oleg Broytman wrote: > >> On Mon, Feb 11, 2013 at 03:49:39PM +0300, anatoly techtonik < >> techto...@gmail.com> wrote: >> > Python Contributor Agreement >> > >> > I allow PSF to release all my code that I

Re: [Python-Dev] My CLA

2013-02-11 Thread anatoly techtonik
On Mon, Feb 11, 2013 at 4:01 PM, Oleg Broytman wrote: > On Mon, Feb 11, 2013 at 03:49:39PM +0300, anatoly techtonik < > techto...@gmail.com> wrote: > > Python Contributor Agreement > > > > I allow PSF to release all my code that I submitted to > > it, under any open s

Re: [Python-Dev] Submitting PEP 422 (Simple class initialization hook) for pronouncement

2013-02-11 Thread Guido van Rossum
Hi Nick, I think this will make a fine addition to the language. I agree that it is superior to the alternatives and fulfills a real (if rare) need. I only have a few nits/questions/suggestions. - With PJE, I think __init_class__ should automatically be a class method. The same way that __new__

Re: [Python-Dev] Question regarding: Lib/_markupbase.py

2013-02-11 Thread Developer Developer
Thank you David, I didn't think of the issue tracker. I have just done it. Guido - Ursprüngliche Message - Von: R. David Murray An: Developer Developer CC: "python-dev@python.org" Gesendet: 16:59 Montag, 11.Februar 2013 Betreff: Re: [Python-Dev] Question regarding: Lib/_markupbase.py

Re: [Python-Dev] Question regarding: Lib/_markupbase.py

2013-02-11 Thread R. David Murray
If these don't get reported as tracker issues they will probably get lost. --David On Mon, 11 Feb 2013 14:47:00 +, Developer Developer wrote: > Same thing in the function: "_parse_doctype_attlist": > > if ")" in rawdata[j:]: >     j = rawdata.find(")", j) + 1 > else: >     return -1 >

Re: [Python-Dev] checking what atexit handlers are registered in Python 3

2013-02-11 Thread Barry Warsaw
On Feb 10, 2013, at 10:36 AM, Chris Withers wrote: >One rough edge I've hit: I see the atexit module has moved to be C-based and, >as far as I can tell, no longer allows you to introspect what atexit >functions have been registered. > >If I'm writing tests for code that registers atexit handlers,

Re: [Python-Dev] Submitting PEP 422 (Simple class initialization hook) for pronouncement

2013-02-11 Thread Antoine Pitrou
Le Mon, 11 Feb 2013 10:15:36 -0500, Barry Warsaw a écrit : > On Feb 10, 2013, at 03:28 PM, Antoine Pitrou wrote: > > >Sure, every little addition is "trivial". At the end you have a scary > >monster made of many little trivial additions along the years, and > >everyone has to take care not to bre

Re: [Python-Dev] Submitting PEP 422 (Simple class initialization hook) for pronouncement

2013-02-11 Thread Barry Warsaw
On Feb 11, 2013, at 08:33 PM, Nick Coghlan wrote: >I like that. Perhaps the PEP should propose some additional guidance >in PEP 8 regarding class based metaprogramming? I wouldn't put it in PEP 8, since it'll glaze the eyes of all but 6 people on the planet. Probably better as a HOWTO in the doc

Re: [Python-Dev] Submitting PEP 422 (Simple class initialization hook) for pronouncement

2013-02-11 Thread Barry Warsaw
On Feb 10, 2013, at 02:34 PM, Antoine Pitrou wrote: >zope.interface has been ported to Python 3, so the annoyance can't be >very blocking. The syntax is different, but I actually prefer the Python 3-compatible syntax better. It uses a class decorator instead of a magic class attribute, so it's m

Re: [Python-Dev] Submitting PEP 422 (Simple class initialization hook) for pronouncement

2013-02-11 Thread Barry Warsaw
On Feb 10, 2013, at 03:28 PM, Antoine Pitrou wrote: >Sure, every little addition is "trivial". At the end you have a scary >monster made of many little trivial additions along the years, and >everyone has to take care not to break it. Why Antoine, that surely isn't the case with the import system

Re: [Python-Dev] [Python-checkins] cpython (3.3): Reject float as uid or gid.

2013-02-11 Thread Serhiy Storchaka
On 11.02.13 01:06, Eric V. Smith wrote: > Instead of special-casing float, isn't using __index__ the preferred way > to do this? Perhaps. I just copied this code from PyArg_ParseTuple*() for 'l' format. ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] Question regarding: Lib/_markupbase.py

2013-02-11 Thread Developer Developer
Same thing in the function: "_parse_doctype_attlist": if ")" in rawdata[j:]:     j = rawdata.find(")", j) + 1 else:     return -1 I would change it to: pos = rawdata.find(")", j) if pos != -1:     j = pos + 1 else:     return -1 Best regards, Guido - Ursprüngliche Message - Von: Fred

Re: [Python-Dev] _not_found attribute on ImportError

2013-02-11 Thread Brett Cannon
On Mon, Feb 11, 2013 at 9:23 AM, Barry Warsaw wrote: > On Feb 11, 2013, at 09:23 PM, Nick Coghlan wrote: > > >On Mon, Feb 11, 2013 at 8:58 PM, Chris Withers > wrote: > >> Have any other exceptions grown new attributes in Python 3? > > > >Off the top of my head, ImportError grew "name" and "path"

Re: [Python-Dev] _not_found attribute on ImportError

2013-02-11 Thread Barry Warsaw
On Feb 11, 2013, at 09:23 PM, Nick Coghlan wrote: >On Mon, Feb 11, 2013 at 8:58 PM, Chris Withers wrote: >> Have any other exceptions grown new attributes in Python 3? > >Off the top of my head, ImportError grew "name" and "path" attributes >in 3.3, everything grew __cause__, __context__ and __tr

Re: [Python-Dev] Question regarding: Lib/_markupbase.py

2013-02-11 Thread Fred Drake
On Mon, Feb 11, 2013 at 7:16 AM, Developer Developer wrote: > Wouldn't it be better to do the following? ... > Otherwise I think we are scanning rawdata[j:] twice. Yes, that would be better, and avoids a string object creation as well. -Fred -- Fred L. Drake, Jr. "A storm broke loose in

Re: [Python-Dev] [Python-checkins] Daily reference leaks (b53b029895df): sum=2

2013-02-11 Thread Eli Bendersky
On Sun, Feb 10, 2013 at 9:00 PM, wrote: > results for b53b029895df on branch "default" > > > test_concurrent_futures leaked [2, 1, -1] memory blocks, sum=2 > > When did this start happening? Eli ___ Python-D

Re: [Python-Dev] My CLA

2013-02-11 Thread Oleg Broytman
On Mon, Feb 11, 2013 at 03:49:39PM +0300, anatoly techtonik wrote: > Python Contributor Agreement > > I allow PSF to release all my code that I submitted to > it, under any open source license. Good intention but wrong way of expressing it. Please do it properly -

[Python-Dev] My CLA

2013-02-11 Thread anatoly techtonik
Python Contributor Agreement I allow PSF to release all my code that I submitted to it, under any open source license. -- anatoly t. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/py

[Python-Dev] Question regarding: Lib/_markupbase.py

2013-02-11 Thread Developer Developer
Hello all, I was having a look at the file: Lib/_markupbase.py (@ 82151), function: "_parse_doctype_element" and have seen something that has caught my attention: if '>' in rawdata[j:]:     return rawdata.find(">", j) + 1 Wouldn't it be better to do the following? pos = rawdata.find(">", j) if

Re: [Python-Dev] _not_found attribute on ImportError

2013-02-11 Thread Nick Coghlan
On Mon, Feb 11, 2013 at 8:58 PM, Chris Withers wrote: > Have any other exceptions grown new attributes in Python 3? Off the top of my head, ImportError grew "name" and "path" attributes in 3.3, everything grew __cause__, __context__ and __traceback__ attributes in 3.0 and the __suppress_context__

Re: [Python-Dev] _not_found attribute on ImportError

2013-02-11 Thread Chris Withers
On 11/02/2013 10:54, Nick Coghlan wrote: On Mon, Feb 11, 2013 at 6:08 PM, Chris Withers wrote: Hi All, I see in Python 3, some ImportErrors have grown a '_not_found' attribute. What's the significance of this attribute and where/how is it added? The only way I can seem to create this attribut

Re: [Python-Dev] _not_found attribute on ImportError

2013-02-11 Thread Nick Coghlan
On Mon, Feb 11, 2013 at 6:08 PM, Chris Withers wrote: > Hi All, > > I see in Python 3, some ImportErrors have grown a '_not_found' attribute. > What's the significance of this attribute and where/how is it added? > > The only way I can seem to create this attribute is: > > ex = ImportError > ex._n

Re: [Python-Dev] Submitting PEP 422 (Simple class initialization hook) for pronouncement

2013-02-11 Thread Nick Coghlan
On Mon, Feb 11, 2013 at 7:41 AM, PJ Eby wrote: > On Sun, Feb 10, 2013 at 11:48 AM, Stefan Behnel wrote: >> So, the way to explain it to users would be 1) don't use it, 2) if you >> really need to do something to a class, use a decorator, 3) if you need to >> decide dynamically what to do, define

[Python-Dev] _not_found attribute on ImportError

2013-02-11 Thread Chris Withers
Hi All, I see in Python 3, some ImportErrors have grown a '_not_found' attribute. What's the significance of this attribute and where/how is it added? The only way I can seem to create this attribute is: ex = ImportError ex._not_found = True cheers, Chris -- Simplistix - Content Managemen

Re: [Python-Dev] Submitting PEP 422 (Simple class initialization hook) for pronouncement

2013-02-11 Thread Antoine Pitrou
On Sun, 10 Feb 2013 16:27:49 -0500 PJ Eby wrote: > On Sun, Feb 10, 2013 at 7:32 AM, Nick Coghlan wrote: > >class Example: > >@classmethod > >def __init_class__(cls): > > Is the @classmethod required? What happens if it's not present? > > Second, will type have a default __i