https://github.com/richardarpanet/hasattr-safe
Python 3 hasattr behaviour for Python 2.
https://github.com/richardarpanet/hasattr-safe
hasattr python-library python2 python3
Last synced: 3 months ago
JSON representation
Python 3 hasattr behaviour for Python 2.
- Host: GitHub
- URL: https://github.com/richardarpanet/hasattr-safe
- Owner: richardARPANET
- Created: 2018-04-03T20:59:22.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-28T22:01:41.000Z (almost 8 years ago)
- Last Synced: 2025-01-19T05:48:20.806Z (about 1 year ago)
- Topics: hasattr, python-library, python2, python3
- Language: Python
- Homepage: https://code.richard.do/richardARPANET/hasattr-safe
- Size: 15.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.rst
Awesome Lists containing this project
README
**NOTICE**: If you're reading this on GitHub.com please be aware this is a mirror of the primary remote located at https://code.richard.do/explore/projects.
Please direct issues and pull requests there.
# hasattr_safe
[](https://travis-ci.org/richardasaurus/hasattr-safe)
`hasattr()` in Python 2 hides all exceptions, `hasattr_safe()` does not, as is the behaviour in Python 3.
### Installation
```bash
pip install hasattr-safe
```
### Usage
```python
import hasattr_safe
cake_is_a_lie = hasattr_safe(TheCake, 'lies')
```
[https://docs.python.org/3/library/functions.html#hasattr](https://docs.python.org/3/library/functions.html#hasattr)