# HG changeset patch # User Atul Varma # Date 1213165497 25200 # Node ID ddcbdec075bc5036b74bdec4242d2c57c43af6c4 # Parent d3f486bfd35443134b434041dfd02b8eff4fcaf8 Removed the whole section on using hasattr() as a replacement for undefined. diff -r d3f486bfd354 -r ddcbdec075bc PythonForJsProgrammers.txt --- a/PythonForJsProgrammers.txt Tue Jun 10 23:22:16 2008 -0700 +++ b/PythonForJsProgrammers.txt Tue Jun 10 23:24:57 2008 -0700 @@ -261,12 +261,7 @@ ... AttributeError: 'str' object has no attribute 'foo' -In most cases, this is for the best, as it makes debugging easier. If -you really need to find out if an object has a particular attribute, -however, you can use the ``hasattr()`` function: - - >>> hasattr("a string", "foo") - False +In most cases, this is for the best, as it makes debugging easier. Python also has an analog to JavaScript's ``null``: it's called ``None``.