getname Library
The `getname` library, currently at version 0.1.1, provides simple functions to retrieve popular names for categories such as cats, dogs, superheroes, and supervillains. It is designed for straightforward use cases requiring quick access to lists of themed names. The library has an infrequent release cadence, with the last update in January 2023.
Common errors
-
AttributeError: module 'getname' has no attribute 'get_cat_name'
cause Attempting to call functions with an incorrect naming convention. The library uses direct category names as function names (e.g., `cat`, `dog`) rather than common 'get_' prefixes.fixUse the exact function names provided by the library: `getname.cat()`, `getname.dog()`, `getname.superhero()`, `getname.supervillain()`. -
TypeError: getname.cat() takes 0 positional arguments but 1 was given
cause Attempting to pass arguments to functions like `getname.cat()`, perhaps expecting to specify count or filters. The functions in `getname` do not accept any arguments.fixCall the functions without any arguments: `getname.cat()`. To get multiple names, call the function multiple times in a loop or list comprehension.
Warnings
- gotcha Functions like `getname.cat()` return a single random name (a string), not a list of names. If you need multiple names, you must call the function multiple times.
- gotcha The library's name datasets are static and embedded within the package version. They do not update dynamically from an external source. New names are only added with a new library release.
- gotcha There are no configuration options or arguments to control the number of names returned, specific attributes of names (e.g., gender, origin), or to filter the lists. Each function simply returns one random name from its internal list.
Install
-
pip install getname
Imports
- getname
import getname
Quickstart
import getname
print("Random Cat Name:", getname.cat())
print("Random Dog Name:", getname.dog())
print("Random Superhero Name:", getname.superhero())
print("Random Supervillain Name:", getname.supervillain())