Comments (5)
Do you have any ideas on how to do that ?
from enaml.
If I remember correctly this part of changes is related to WIP-changes in parser.
I think the easiest way to go is to support enaml-syntax version the same as that of the package. I believe the amount of enaml code out there isn't that big, so if one wants to move to Python 3 it won't be a problem to convert enaml code too.
As of the way to achieve this. parser.py
defines the syntax, so we can't implement support of both Python versions in one file. So basically one should take old version and name it for example _parser2.py
, name new version _parser3.py
and choose which module to import in parser.py
based on Python version. Maybe there is more elegant way...
from enaml.
I will have to look at both versions but one way to make things easier to maintain may be to write the parser as a class (possible in pyparsing). This way we can have a base class handling common patterns and add more cases in a Python2 and Python3 subclasses. I will look into both and see what amount of code is duplicated to see whether or not this is pertinent.
from enaml.
Currently there is quite a large amount of common code, but it won't be the case when full Python 3 grammar would be supported. In source of Python there is explicit grammar of the language, and I suspect it was the source for original version of parser.py. You can compare grammars of different Python versions to estimate the amount of common grammar rules, which as I understand you consider putting in base class.
from enaml.
Thanks for the pointer. I will give it a look.
from enaml.
Related Issues (18)
- Update byteplay.py to support Python 3.5 (WITH_CLEANUP is now split into two)
- parser: support py3k syntax for classes (ast.ClassDef has 3 more arguments: 'keywords', 'starargs', 'kwargs') HOT 1
- Update parser: change grammar to support new class syntax
- Update parser: decision regarding grammar HOT 1
- window_closing.enaml demo is not working (TypeError: an integer is required (got type str) in byteplay)
- examples/layout/advanced/override_layout_constraints.enaml example doesn't work HOT 1
- examples/stdlib/message_box.enaml example doesn't work (TypeError: required field "arg" missing from arg)
- examples/templates/advanced.enaml example doesn't work (TypeError: ambiguous template specialization for parameters: (None, <class 'atom.scalars.Unicode'>))
- Wrap 2to3 changes to support both Python 2 and 3
- Working on Python 2/3 cross-compatibility HOT 9
- Supporting both PyQt4 and PyQt5 HOT 2
- Make sure changes in cpp code didn't break Python 2 support, fix if needed HOT 3
- Modify byteplay.py to support both Python 2 and Python 3 HOT 2
- Update parser: get rid of special grammar rules for 'print' statement
- Update parser: new rules to reflect changes in argument lists, check existing argument lists rules
- Update parser: support argument annotations
- Update parser: support function annotations
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from enaml.