A Explitic function Python project
Project description
MoreUpdate
Some Added stuff for python 3
MoreUpdate ae just add more and will more stuff for faster coding.
- Faster coding
- More shorter code
Features
- Explicit Type Function
- Constant Value
- Explicit Type Variable
Installation
Install the dependencies and devDependencies
pip install MoreUpdate
Tutalrial
1.Explicit Type Function
from explict import Function,TYPE
def foo(bar): #wanted bar is a string...
print(bar)
# Used : Function(Your_def,..Some type with TYPE.<TYPE>.get())
foo = Function(foo,TYPE.STRING.get())
#.call(argument) to call that function
foo.call("Hello")
foo.call(123) #Error goes here!
Hello
TypeError: type of 123 <class 'int'> is not <class 'str'>
[Finished in 233ms]
2.Constant
from explict import Constant
a = Constant("123")
a.get() # return "123" no set
3.Explicit Type variable
from explict import Var
a = Var("123")
a.get() # return "123"
a.set("1234") # Fine
print(a.get()) # 1234
a.set(123) #Uh oh...
print(a.get())
1234
TypeError: 123 Have type of <class 'int'> not <class 'str'>
[Finished in 95ms]
4.All TYPE built-in
from explict import TYPE,Constant,Function
# TYPE.STRING.get() # String type "Hello"
# TYPE.INT.get() # Integer type 123
# TYPE.FLOAT.get() # Float type 1.23
# TYPE.OBJECT.get() # Dict or Object type {"a":1}
# TYPE.BYTE.get() # Byte like b'123'
# TYPE.ARRAY.get() # That array type []
#Create Your own TYPE
class MyType:
def __init__(self,v):
self.v = v
def say(self):
print(f"Hi {self.v}")
TYPE.MYTYPENAME = Constant(MyType("Some example Value"))
#used your type
def sayhi(mytype):
mytype.say()
sayhi = Function(sayhi,TYPE.MYTYPENAME.get()) # <class '__main__.MyType'>
A = MyType("123")
sayhi.call(A)
sayhi.call("123")
Hi 123
TypeError: type of 123 <class 'str'> is not <class '__main__.MyType'>
[Finished in 194ms]
Video comming soon..
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
MoreUpdate-1.0.2.tar.gz
(5.6 kB
view hashes)
Built Distribution
Close
Hashes for MoreUpdate-1.0.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc76da069fc495d0927ad46717adb05b3e57f29d33a464310179e3327c87cf85 |
|
MD5 | a3b0621cb8b7bca7fbf241c6cc1ddd28 |
|
BLAKE2b-256 | eccf00f8ec736994a7847c4947d5a3b83e2917647d506c31a6e9e35b59b9f762 |