Home
Define If¶
If the condition is true, define the method.
For more information see: https://defineif.hakancelik.dev/
How to install ?¶
pip install defineif
How to use it ?¶
import os
from defineif import DefineIf
class Klass(DefineIf):
@staticmethod
@DefineIf(os.name == 'nt')
def get_platform():
return 'Windows'
@staticmethod
@DefineIf(os.name == 'posix')
def get_platform():
return 'Linux'
platform = Klass.get_platform()
print(platform)
Last update: November 21, 2022
Created: November 21, 2022
Created: November 21, 2022