Category:Python: Difference between revisions
Content added Content deleted
(Suggest using <lang python> for examples) |
m (this is a wiki --m) |
||
Line 8: | Line 8: | ||
It is easy to create clean bug-free programs in Python due to the motto: "Errors should never pass silently." Python source files (.py files) are typically compiled to an intermediate [[bytecode]] language (.pyc files) and executed by a Python Virtual Machine. |
It is easy to create clean bug-free programs in Python due to the motto: "Errors should never pass silently." Python source files (.py files) are typically compiled to an intermediate [[bytecode]] language (.pyc files) and executed by a Python Virtual Machine. |
||
Note: because Python uses whitespace for structure, do not format long code examples with leading whitespace, instead use <nowiki><pre></pre></nowiki> tags. This will make it easier to copy code into and out of the wiki. Example: |
Note: because Python uses whitespace for structure, do not format long code examples with leading whitespace, instead use <nowiki><pre></pre></nowiki> tags, or, preferably, <nowiki><lang ruby></lang></nowiki> tags. This will make it easier to copy code into and out of the wiki. Example: |
||
⚫ | |||
<pre> |
|||
print 'this line must not have leading indentation!' |
print 'this line must not have leading indentation!' |
||
</pre> |
|||
The <nowiki><lang python></lang></nowiki> tag adds syntax highligthing: |
|||
⚫ | |||
if True: |
if True: |
||
print 'example: ', foo(3), len(bar) |
print 'example: ', foo(3), len(bar) |