Skip to main content

many pattern in python

Project description

HELLO THERE


Code Example

class MyClass:
    def __init__(self):
        self.var1 = 5     # default value
        self.var2 = int() # type define
    
    def __str__(self):
        temp = [f"{key} : {value}" for key, value in self.__dict__.items()]
        return ", ".join(temp) # return like 'var1 : value1, ...'


a = Builder(MyClass)
print(a) # not build

b = Builder(MyClass).build()
print(b) # build

c = Builder(MyClass)
print(c.build()) # same at b

d = Builder(MyClass).add('var1', 1).build()
print(d) # var1 initialize 1

e = Builder(MyClass).add('var1', 10) \
                    .add('var2', 5) \
                    .build() # var1 = 10, var2 = 5

b = Builder(MyClass)
b.add('var1', 0)
b.add('var2', 5**2)
print(b.build())

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

pyasset-0.0.1.tar.gz (1.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyasset-0.0.1-py3-none-any.whl (2.0 kB view details)

Uploaded Python 3

File details

Details for the file pyasset-0.0.1.tar.gz.

File metadata

  • Download URL: pyasset-0.0.1.tar.gz
  • Upload date:
  • Size: 1.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for pyasset-0.0.1.tar.gz
Algorithm Hash digest
SHA256 625e134138e7f461ce0ccf1ed8c9bab2c081c55db3b9555599d4f446bea419d6
MD5 ebb3b3801bd70dbf4574d58cde536499
BLAKE2b-256 6a9d3a93b5d9eb9ee2654897148d5e11b942cd38898ca5db12bcef4eb3258b37

See more details on using hashes here.

File details

Details for the file pyasset-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyasset-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for pyasset-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6a08a3683eafcf6548e1a1b8a2ff42434628956f6c987f26a97e6d2af6c303c9
MD5 8cc55fa139ee3c30ae204f3e151d88f6
BLAKE2b-256 8936ca09e1bb978c0f3c8597ad5e89672bd7387c8df363590fbf7ec971ec9756

See more details on using hashes here.

Supported by

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