<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 21 June 2016 at 06:12, Guido van Rossum <span dir="ltr"><<a href="mailto:guido@python.org" target="_blank">guido@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra">OK, basically you're arguing that knowing the definition order of class attributes is often useful when (ab)using Python for things like schema or form definitions. There are a few ways to go about it:<br><br></div><div class="gmail_extra">1. A hack using a <a href="https://github.com/GoogleCloudPlatform/datastore-ndb-python/blob/master/ndb/model.py#L888" target="_blank">global creation counter</a><br></div><div class="gmail_extra">2. <a href="https://docs.python.org/3/reference/datamodel.html#prepare" target="_blank">Metaclass with __prepare__</a><br></div><div class="gmail_extra">3. <a href="https://www.python.org/dev/peps/pep-0520/" target="_blank">PEP 520</a><br></div><div class="gmail_extra">4a. <a href="http://bugs.python.org/issue27350" target="_blank">Make all dicts OrderedDicts in CPython</a><br>4b. Ditto in the language standard<br><br></div><div class="gmail_extra">If we can make the jump to (4b) soon enough I think we should skip PEP 520; if not, I am still hemming and hawing about whether PEP 520 has enough benefits over (2) to bother.<br><br></div><div class="gmail_extra">Sorry Eric for making this so hard. The better is so often the enemy of the good. I am currently somewhere between -0 and +0 on PEP 520. I'm not sure if the work on (4a) is going to bear fruit in time for the <a href="https://www.python.org/dev/peps/pep-0494/#schedule" target="_blank">3.6 feature freeze</a>; if it goes well I think we should have a separate conversation (maybe even a PEP?) about (4b). Maybe we should ask for feedback from the Jython developers? (PyPy already has this IIUC, and <a href="https://github.com/IronLanguages/main" target="_blank">IronPython</a> seems moribund?)</div></div></blockquote><div><br></div><div>Although not a Jython developer, I've looked into the code a few times.</div><div><br></div><div>The major stumbling block as I understand it will be that Jython uses a ConcurrentHashMap as the underlying structure for a dictionary. This would need to change to a concurrent LinkedHashMap, but there's no such thing in the standard library. The best option would appear to be <a href="https://github.com/ben-manes/concurrentlinkedhashmap">https://github.com/ben-manes/concurrentlinkedhashmap</a>.<br></div><div><br></div><div>There are also plenty of other places that use maps and all of them would need to be looked at. In a lot of cases they're things like IdentityHashMap which may also need an ordered equivalent.</div><div><br></div><div><div>There is a repo for Jython 3.5 development: <a href="https://github.com/jython/jython3">https://github.com/jython/jython3</a> but it doesn't seem to be very active - only 11 commits in the last year (OTOH that's also in the last 3 months).</div><div><br></div></div><div>Tim Delaney </div></div></div></div>