[issue24254] Make class definition namespace ordered by default

2017-05-17 Thread Jesús Cea Avión

Changes by Jesús Cea Avión :


--
nosy: +jcea

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-12-06 Thread Nick Coghlan

Nick Coghlan added the comment:

Thanks for the ping Ned.

Closing this again, as Guido explained the rationale for the change in the 
python-dev thread referenced above: 
https://mail.python.org/pipermail/python-dev/2016-September/146371.html

--
resolution:  -> fixed
stage: commit review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-12-06 Thread Ned Deily

Ned Deily added the comment:

What's the status of this issue?  It's still marked as a "deferred blocker" for 
3.6.

--
nosy: +ned.deily

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-09-10 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-09-10 Thread Brett Cannon

Brett Cannon added the comment:

All reasonable points. You just sounded upset and I wanted to point out the 
decision was not made lightly, without discussion with the person in charge of 
the proposal and the BDFL, or we were breaking backwards-compatibility due to 
some drunken ordered dictionary stupor we were in. :)

Anyway, that's it and any further comments I have on this specific topic I'll 
put on the python-dev thread.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-09-10 Thread Nick Coghlan

Nick Coghlan added the comment:

While I hadn't read the related thread at the point where I made that comment 
(so thank you for at least raising the question there), I'm still on the 
opposite side of the planet, so any decision made in less than 24 hours from 
proposal to resolution is necessarily "too fast" for global collaboration (and 
48 hours is better).

I'm not particularly fond of __definition_order__ either, but one of the 
specific points raised in the PEP 520 discussions due to Inada-san's pending 
patch was whether or not making class namespaces ordered by default would 
eliminate the need for the attribute, and the conclusion was that it 
*wouldn't*. So the "We made class namespaces ordered, so now 
__definition_order__ is gone" sounded a lot like folks forgetting that part of 
the discussions, and instead getting rid of a feature that was there for 
multiple reasons, not just because __dict__ didn't preserve the order.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-09-10 Thread Brett Cannon

Brett Cannon added the comment:

Do realize that the PEP author was there and made the decision along with Guido 
to not move forward with a new feature that has not seen the light of day in a 
stable release, so I don't think blaming the sprinting environment is entirely 
fair in this case.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-09-10 Thread Nick Coghlan

Nick Coghlan added the comment:

I don't think this is necessarily a blocker for beta 1 (since it can be treated 
as a bug fix for beta 2 if it's decided to restore the originally proposed 
behaviour), but it should definitely be resolved before beta 2.

--
priority:  -> deferred blocker

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-09-10 Thread Nick Coghlan

Nick Coghlan added the comment:

Reopening until the __definition_order__ question has been resolved.

--
resolution: fixed -> 
stage: resolved -> commit review
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-09-10 Thread Nick Coghlan

Nick Coghlan added the comment:

Ethan started a python-dev thread here: 
https://mail.python.org/pipermail/python-dev/2016-September/146358.html

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-09-10 Thread Nick Coghlan

Nick Coghlan added the comment:

The danger of sprints, and decisions being made without adequate input from 
affected parties.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-09-09 Thread STINNER Victor

STINNER Victor added the comment:

You should reopen the discussion on python-dev, since the PEP 520 has
been accepted with:

"Note: Since compact dict has landed in 3.6, __definition_order__ has
been removed. cls.__dict__ now mostly accomplishes the same thing
instead."

The PEP status is now Final.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-09-09 Thread Ethan Furman

Ethan Furman added the comment:

Not having a __definition_order__ could be a disadvantage for classes making 
use of __getattr__ for virtual attributes, such as Enum and proxy classes.

With __definition_order__, and __dir__, Enum could present a coherent view; 
without it it's a big jumbled mess with many attributes the user never wrote.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-09-09 Thread Brett Cannon

Brett Cannon added the comment:

Nope, PEP 520 has been updated to drop __definition_order__ and instead state 
that cls.__dict__ is an ordered mapping.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-09-09 Thread Ethan Furman

Ethan Furman added the comment:

Is this going to be added back?  Should I add __definition_order__ to Enum?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-09-08 Thread Ethan Furman

Changes by Ethan Furman :


--
nosy: +ethan.furman

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-09-08 Thread Eric Snow

Changes by Eric Snow :


--
Removed message: http://bugs.python.org/msg275185

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-09-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9aa5424fd1df by Eric Snow in branch 'default':
Issue #24254: Drop cls.__definition_order__.
https://hg.python.org/cpython/rev/9aa5424fd1df

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-09-08 Thread Eric Snow

Eric Snow added the comment:

Note that most of the changes here have been reverted in changeset 
103366:a964b8d2324e9f22a66e458ea72e6d5c8c1fcc93.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-09-05 Thread Eric Snow

Changes by Eric Snow :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-09-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 635fd3912d4d by Eric Snow in branch 'default':
Issue #24254: Preserve class attribute definition order.
https://hg.python.org/cpython/rev/635fd3912d4d

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-08-29 Thread Nick Coghlan

Nick Coghlan added the comment:

Because we're not making ordered-by-default dicts a language specification 
level requirement, so portable code can't rely on them.

However, the PEP at https://www.python.org/dev/peps/pep-0520/ is deliberately 
worded so that there's no requirement for the class body execution namespace to 
specifically be collections.OrderedDict - it just needs to be order preserving 
so that __definition_order__ can be populated.

If someone reviews and merges the compact ordered dict patch, then this patch 
can likely be made a lot simpler.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-08-29 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +fijall

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-08-29 Thread STINNER Victor

STINNER Victor added the comment:

Brett Cannon added the comment:
> Any update on this? b1 is exactly 2 weeks away at this point.

Why do we need changes specific to classes, if dictionaries could be ordered by 
default?

Issue #27350: "Compact and ordered dict" by INADA Naoki

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-08-29 Thread Brett Cannon

Brett Cannon added the comment:

Any update on this? b1 is exactly 2 weeks away at this point.

--
nosy: +brett.cannon

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-07-19 Thread Eric Snow

Changes by Eric Snow :


--
hgrepos:  -310

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-07-19 Thread Eric Snow

Changes by Eric Snow :


Removed file: http://bugs.python.org/file43629/deforder-with-tp-slot.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-07-15 Thread Eric Snow

Eric Snow added the comment:

post-review updates

--
Added file: http://bugs.python.org/file43739/deforder-with-tp-slot.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-07-14 Thread Eric Snow

Eric Snow added the comment:

FTR: PEP 520 "Preserving Class Attribute Definition Order" 
(https://www.python.org/dev/peps/pep-0520/)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-07-05 Thread Eric Snow

Eric Snow added the comment:

Here's an updated patch that matches the accepted PEP.  Most notably I've added 
a tp_deforder slot.  This was necessary because subclasses should not inherit 
their parent's __definition_order__ and the ability to delete 
cls.__definition_order__ makes this problematic.  I didn't see a way to do that 
without adding a new type slot.

--
Added file: http://bugs.python.org/file43629/deforder-with-tp-slot.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-06-13 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-06-04 Thread Nick Coghlan

Nick Coghlan added the comment:

The patch looks good to me as a reference implementation, but I think it's 
worth writing up as a short PEP so there's a clear reference from the What's 
New documentation, and so developers of other implementations have a chance to 
review and comment on the change.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-06-03 Thread Eric Snow

Changes by Eric Snow :


Added file: http://bugs.python.org/file43169/deforder.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-06-03 Thread Eric Snow

Changes by Eric Snow :


Removed file: http://bugs.python.org/file43168/deforder.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-06-03 Thread Eric Snow

Eric Snow added the comment:

Here's the full patch, including the addition of __definition_order__, tests, 
and docs.

--
Added file: http://bugs.python.org/file43168/deforder.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-06-02 Thread Eric Snow

Eric Snow added the comment:

Thanks.  Yeah, I wanted to keep the patches separate for the sake of code 
review.  I'll fold the changes into a single commit once everything's ready.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-06-02 Thread Nick Coghlan

Nick Coghlan added the comment:

Patch review sent. The motivation for the change is relatively weak without 
__definition_order__, though :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-05-12 Thread Eric Snow

Eric Snow added the comment:

Here's a refresh of the patch that only sets the default definition namespace 
(and does not introduce __definition_order__).

--
Added file: http://bugs.python.org/file42834/just-default-to-odict.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2016-05-12 Thread Eric Snow

Changes by Eric Snow :


Removed file: http://bugs.python.org/file39456/just-default-to-odict.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2015-05-25 Thread Eric Snow

Eric Snow added the comment:

I've moved this to 3.6.  Small as the patch might be, there just isn't enough 
urgency to warrant making use of an exception to get it into 3.5.  If 
__definition_order__ were still on the table then I'd probably still push for 
3.5. :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2015-05-25 Thread Eric Snow

Changes by Eric Snow :


--
priority: release blocker -> 
stage:  -> patch review
versions: +Python 3.6 -Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2015-05-25 Thread Eric Snow

Eric Snow added the comment:

Thanks for pointing out types.prepare_class.  I've updated it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2015-05-25 Thread Nick Coghlan

Nick Coghlan added the comment:

This is *not* about changing the default type of class dictionaries (which
I agree would be far too large a change to make without a PEP), it's only
about changing the ephemeral evaluation namespace used to execute the class
body.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2015-05-25 Thread Eric Snow

Eric Snow added the comment:

This is not about changing the default type for class dictionaries.  It is only 
for changing the default type used during class definition.  Essentially, we 
are just changing the type of what is returned from `type.__prepare__`.  
cls.__dict__ will remain a dict.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2015-05-25 Thread STINNER Victor

STINNER Victor added the comment:

> It may be a stretch to get this into 3.5, but the final change should be 
> pretty small.

Changing the default type of class dictionaries is a huge change. IMO it should 
be deferred to Python 3.6.

--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2015-05-25 Thread Eric Snow

Eric Snow added the comment:

Per discussion on python-dev, I'm tabling the __definition_order__ part to 3.6. 
 I'll open a thread on python-ideas on it later and open a new issue here if I 
get a positive response.

So this issue is just about making OrderedDict the default namespace type for 
class definitions.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2015-05-25 Thread Eric Snow

Changes by Eric Snow :


--
priority: normal -> release blocker

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2015-05-23 Thread Eric Snow

Changes by Eric Snow :


--
hgrepos: +310

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2015-05-23 Thread Nick Coghlan

Nick Coghlan added the comment:

types.prepare_class() also needs to be updated to use OrderedDict() by default.

--
dependencies: +Add OrderedDict written in C

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2015-05-21 Thread Eric Snow

Eric Snow added the comment:

Here's a patch that drops adding __definition_order__.  You can get the same 
effect by adding `__definition_order__ = list(locals())` at the bottom of your 
class definition.  The benefit of having `__definition_order__` is that the 
information is automatically available for later use rather than forcing the 
class author to add the above line in order to benefit from external 
introspection/manipulation.  The downside is that every syntax-defined class 
will have the extra attribute with the list of definition order, which might be 
an unnecessary waste, even if not a huge one.

Ultimately, I'd prefer to keep `__definition_order__`.

--
Added file: http://bugs.python.org/file39456/just-default-to-odict.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24254] Make class definition namespace ordered by default

2015-05-20 Thread Eric Snow

New submission from Eric Snow:

Here's a work-in-progress patch that uses OrderedDict as the default class 
definition namespace (instead of dict).  While the actual class namespace is a 
dict, the definition order is preserved on a new attribute on class objects: 
__definition_order__.  This is useful for cases such as class decorators that 
would make use of the definition order to post-process the class.  This is 
something that Guido okay'ed a while back.

It may be a stretch to get this into 3.5, but the final change should be pretty 
small.  It also depends on the C implementation of OrderedDict (see issue 
#16991) which has not landed and may not make it in time.

Note that the patch is still a bit buggy, partly due to bugs in the C 
OrderedDict patch.  Also, the attached patch is based off the C OrderedDict 
patch, so I expect reitveld won't be able to handle it.  The code on which the 
patch is based may be found in the "class-namespace" branch of 
https://pypi.python.org/pypi/cyordereddict.

--
assignee: eric.snow
components: Interpreter Core
files: odict-class-definition-namespace.diff
keywords: patch
messages: 243729
nosy: eric.snow, ncoghlan
priority: normal
severity: normal
status: open
title: Make class definition namespace ordered by default
type: behavior
versions: Python 3.5
Added file: 
http://bugs.python.org/file39446/odict-class-definition-namespace.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com