Skip to main content
https://img.shields.io/travis/honewatson/defaultsob.svg https://img.shields.io/pypi/v/defaultsob.svg

A simple package to create data structures with defaults and strict limitations of attributes/properties.

Features

class User(Defaults):
    __slots__ = [
       "name",
       "description",
       "an_attribte_with_no_default"
   ]
   """
   usef will use the 'name' attribute
   if the description attribute is not
   set at the time of object creation
   """
   description = usef('name')

user = User(name='Billy')
"""
.to_dict_clean method returns a
dictionary of attributes with values
"""
print(user.to_dict_clean())
{
   "name": "Billy",
   "description": "Billy"
}

user.description = "Something Else"
user.an_attribute_with_no_default = "Another"
print(user.to_dict_clean())
{
   "name": "Billy",
   "description": "Something Else"
   "an_attribute_with_no_default": "Another"
}


user2 = User(name="Billy", description="The Kid")
print(user2.to_dict_clean())
{
   "name": "Billy",
   "description": "The Kid"
}

History

0.1.0 (2015-01-11)

  • First release on PyPI.

Release files for defaultsob 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for defaultsob 0.3.0
File Size Uploaded
defaultsob-0.3.0.tar.gz 13.2 kB Details

Release files / defaultsob-0.3.0.tar.gz

Download URL defaultsob-0.3.0.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cf5a397f1c37639404a24de8323a1165781c6b5d9fd5f6eb94219e4d56f80b63
BLAKE2b-256 checksum
How to use checksums
eca3dd2e8119d691019f7851e52fd2f160eea55e21c5918f0413da6858aa0aad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.3.0 This release

1 release file

0.1.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page