Skip to content

Commit

Permalink
CLN: Add __bool__ alias for __nonzero__
Browse files Browse the repository at this point in the history
Python3 uses __bool__, not __nonzero__
  • Loading branch information
jtratner committed Jul 29, 2013
1 parent b83784f commit 0c0cfbc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,9 @@ def empty(self):
def __nonzero__(self):
return not self.empty

# Python 3 compat
__bool__ = __nonzero__

@property
def ndim(self):
return self._data.ndim
Expand Down
3 changes: 3 additions & 0 deletions pandas/core/internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,9 @@ def make_empty(self):
def __nonzero__(self):
return True

# Python3 compat
__bool__ = __nonzero__

@property
def ndim(self):
return len(self.axes)
Expand Down

0 comments on commit 0c0cfbc

Please sign in to comment.