Obtain the name of the type of an object
Project description
Typename
The typename
module defines a single function also called typename
which returns the name of the
type of any object as a string.
Its purpose is purely aesthetic, to avoid unsightly constructs such as type(obj).__name__
or the
ghastly obj.__class__.__name__
.
Installation
The typename
package is available on the Python Package Index (PyPI):
Typename should work with any version of Python 3. To install:
With pip
from PyPI:
pip install typename
How to use
>>> from typename import typename
>>> x = 5
>>> typename(x)
'int'
MIT License
Copyright (c) Sixty North
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file typename-1.0.4.tar.gz
.
File metadata
- Download URL: typename-1.0.4.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3db47d5df84d6667ce23456c7775eb658314c413667549e787f5657e825923f |
|
MD5 | 19f2694154109694cbe4bfe8a62e8529 |
|
BLAKE2b-256 | 2fc1a505c885b63161ea3588baa48ea1a3a664cafc40fe7b784ee15f9558164e |
File details
Details for the file typename-1.0.4-py3-none-any.whl
.
File metadata
- Download URL: typename-1.0.4-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba422aa55026a86632d5c12ac58fff2893fb3dc85e119b3d11cb21a945e7d1ad |
|
MD5 | e413ddade720c7de9387fd19524a2539 |
|
BLAKE2b-256 | 29e1b6752e5131f90b47aa618c73e77dd6703e5ddc420851c7b2c1d4306b64db |