#12342: things I don't like about the json <--> hg conversion code
----------------------------+-----------------------------------------------
Reporter: was | Owner: tbd
Type: defect | Status: new
Priority: critical | Milestone: sage-5.0
Component: distribution | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author:
Merged: | Dependencies:
----------------------------+-----------------------------------------------
Comment(by kini):
Good morning and happy Chinese New Year from Singapore! Thanks for making
this followup ticket, as my code could certainly be improved.
The main reason I didn't explain the command line usage of
`json_bundle.py` anywhere is that it was not really meant to be used by
the user - the interface to this code was to have been through `make text-
expand` and `make text-collapse`. The only reason there are command line
arguments at all is that I thought someone might want to expand on the
functionality of the .py file later. But certainly you're right that
putting an explanation in anyway helps anyone who is trying to debug or
modify the code, and it improves modularity do so as well.
Looking at your new code, minor comment about exceptions:
{{{
#!python
# this is legacy syntax which is removed in Python 3
raise ExceptionType, "message"
except ExceptionType, e
# this is the currently recommended syntax
raise ExceptionType("message")
except ExceptionType as e
}}}
I see a lot of the former syntax in Sage. The Python website tells me that
"well-written 2.x code can be a lot like 3.x code", meaning, I guess, that
much of the Python 3 syntax is already standard in 2.6 and 2.7 and we
should use it. So I usually try to do this, but maybe it's too early to
start planning for Python 3 in Sage? After all we only just got 2.7 in in
Sage 5.0.
Anyway, you said you're going to work on this yourself, but if you want me
to help with anything just let me know. I'll be keeping an eye on this
ticket.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12342#comment:4>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.