Skip to main content

Define fields simply

Project description

pyfieldlib

pyfieldlib library is used to define fields in a simple way.

Install

pip install pyfieldlib

Examples

from pyfieldlib import *


class Human(metaclass=FieldMeta):
    _age = 19
    
    @fields
    def is_mammal(self):
        return True
    
    @fields
    def age(self):
        return Human._age

    @age.setter
    def age(self, value):
        Human._age = value


# get
print(Human.age)  # 19
print(Human.is_mammal)  # True

# set
Human.age = 20
print(Human.age)  # 20
Human.is_mammal = False  # Error

Copyright

Copyright 2023. DuelitDev all rights reserved.

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pyfieldlib-1.0.1-py3-none-any.whl (2.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page