text/python?
Wednesday, 15 December 2004
I’m thinking about whether it would be a good idea to have a media type for Python source files, call it “text/python.”
The main benefit that I see to doing this is the definition of a fragment identifier syntax; i.e., what the bit after the ‘#’ refers to. This would allow URIs to point to specific functions and classes in Python source files, which would be very useful when documenting code.
It would also allow some cool import tricks (if I read PEP 302 correctly, this is possible now, and will soon be pretty easy to enable), such as;
import "https://www.mnot.net/sw/sparta/sparta.py" as sparta
or even
import "https://www.mnot.net/sw/sparta/sparta.py#ThingFactory" as ThingFactory
Some client-side persistent caching could make this a really nice way to distribute software, if properly thought out. It’s also one more step towards Webizing Python.
There are also some smaller, but nice, benefits, like being able to use the media type, rather than content sniffing, for syntax colouring, dispatching to Python editors straight off the Web, and being able to specify the encoding of the source in a way that’s well-aligned with the method that Python already defines.
Thoughts? I’m considering writing an Internet-Draft and/or a PEP, but wanted to get some informal feedback first.
9 Comments
Ian Bicking said:
Tuesday, December 14 2004 at 11:21 AM
Manfred Stienstra said:
Wednesday, December 15 2004 at 2:06 AM
Mark Nottingham said:
Wednesday, December 15 2004 at 3:27 AM
Ian Bicking said:
Wednesday, December 15 2004 at 3:57 AM
Mark Nottingham said:
Wednesday, December 15 2004 at 4:04 AM
Paul Hoffman said:
Wednesday, December 15 2004 at 6:26 AM
Damian Cugley said:
Monday, December 20 2004 at 7:41 AM
Manfred Stienstra said:
Tuesday, December 21 2004 at 2:44 AM
Paul Sowden said:
Thursday, January 6 2005 at 5:32 AM