Mercurial > python-for-js-programmers
changeset 50:ddcbdec075bc
Removed the whole section on using hasattr() as a replacement for undefined.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Tue, 10 Jun 2008 23:24:57 -0700 |
parents | d3f486bfd354 |
children | ac0b1bf6a92b |
files | PythonForJsProgrammers.txt |
diffstat | 1 files changed, 1 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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``.