changeset 5:758a15a83be8

More stuff.
author Atul Varma <varmaa@toolness.com>
date Thu, 05 Jun 2008 15:24:58 -0700
parents ae28bd3be137
children f8aa8d0494ed
files PythonForJsProgrammers.txt
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/PythonForJsProgrammers.txt	Thu Jun 05 15:19:42 2008 -0700
+++ b/PythonForJsProgrammers.txt	Thu Jun 05 15:24:58 2008 -0700
@@ -145,6 +145,21 @@
     ...
     SyntaxError: invalid syntax
 
+Nothingness
+===========
+
+Unlike JavaScript, Python doesn't have a concept of ``undefined``.
+Instead, things that would normally cause ``undefined`` to be returned
+by JavaScript simply end up raising an exception in Python:
+
+    >>> "a string".foo
+    Traceback (most recent call last):
+    ...
+    AttributeError: 'str' object has no attribute 'foo'
+
+Python does have an analog to JavaScript's ``null``: it's called
+``None``.
+
 Functions
 =========