| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 | <!doctype html><html>  <head>    <title>CodeMirror 2: Python mode</title>    <link rel="stylesheet" href="../../lib/codemirror.css">    <script src="../../lib/codemirror.js"></script>    <script src="python.js"></script>    <link rel="stylesheet" href="../../theme/default.css">    <link rel="stylesheet" href="../../css/docs.css">    <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>  </head>  <body>    <h1>CodeMirror 2: Python mode</h1>        <div><textarea id="code" name="code"># Literals12340.0e101.1230b010100111000o012345670x0987654321abcdef721474836473L79228162514264337593543950336L0x100000000L792281625142643375935439503360xdeadbeef3.14j10.j10j.001j1e100j3.14e-10j# String Literals'For\''"God\"""""so lovedthe world"""'''that he gavehis only begotten\' ''''that whosoever believeth \in him'''# Identifiers__a__a.ba.b.c# Operators+ - * / % & | ^ ~ < >== != <= >= <> << >> // **and or not in is# Delimiters() [] {} , : ` = ; @ .  # Note that @ and . require the proper context.+= -= *= /= %= &= |= ^=//= >>= <<= **=# Keywordsas assert break class continue def del elif else exceptfinally for from global if import lambda pass raisereturn try while with yield# Python 2 Keywords (otherwise Identifiers)exec print# Python 3 Keywords (otherwise Identifiers)nonlocal# Typesbool classmethod complex dict enumerate float frozenset int list objectproperty reversed set slice staticmethod str super tuple type# Python 2 Types (otherwise Identifiers)basestring buffer file long unicode xrange# Python 3 Types (otherwise Identifiers)bytearray bytes filter map memoryview open range zip# Some Example codeimport osfrom package import ParentClass@nonsenseDecoratordef doesNothing():    passclass ExampleClass(ParentClass):    @staticmethod    def example(inputStr):        a = list(inputStr)        a.reverse()        return ''.join(a)    def __init__(self, mixin = 'Hello'):        self.mixin = mixin</textarea></div>    <script>      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {        mode: {name: "python",               version: 2,               singleLineStringErrors: false},        lineNumbers: true,        indentUnit: 4,        tabMode: "shift",        matchBrackets: true      });    </script>    <h2>Configuration Options:</h2>    <ul>      <li>version - 2/3 - The version of Python to recognize.  Default is 2.</li>      <li>singleLineStringErrors - true/false - If you have a single-line string that is not terminated at the end of the line, this will show subsequent lines as errors if true, otherwise it will consider the newline as the end of the string. Default is false.</li>    </ul>    <p><strong>MIME types defined:</strong> <code>text/x-python</code>.</p>  </body></html>
 |