Talk:Python (programming language)/Archive 7: Difference between revisions

Content deleted Content added
MalnadachBot (talk | contribs)
m Replaced obsolete font tags and reduced Lint errors. (Task 12)
m Replaced deprecated <source> tags with <syntaxhighlight> (via WP:JWB)
 
Line 134:
The point wasn't that it was awesome python code, rather that it mocks a code example from Ruby's website with their silly perl-esq sigils and magical behavior.
 
<sourcesyntaxhighlight lang="python">
# Python knows what you mean, even if you want to do math on an entire set
cities = set(("""London
Line 146:
print ( "I still need to visit the following cities: "
+ ", ".join(cities - visited) )
</syntaxhighlight>
</source>
<sourcesyntaxhighlight lang="ruby">
# Ruby knows what you
# mean, even if you
Line 163:
"following cities:",
cities - visited
</syntaxhighlight>
</source>
Granted the python example would look nicer with the set literal syntax a la 3.0.
 
Line 241:
 
Boolean operators and Boolean built-in types always return one of the Boolean values True and False ''except'' for the operators "<code>or</code>" and "<code>and</code>" which return one of their operands (from left to right, the first operand that determines the Boolean value of the expression).<ref>{{cite web| title=Boolean operations | url=http://docs.python.org/ref/Booleans.html}}</ref>
<sourcesyntaxhighlight lang="python">
>>> class spam: pass # spam is assigned a class object.
...
Line 254:
<class __main__.spam at 0x01292660>
>>>
</syntaxhighlight>
</source>
----
----