Skip to main content

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.3.tar.gz (5.6 kB view hashes)

Uploaded Source

Built Distribution

MoreUpdate-1.0.3-py2.py3-none-any.whl (3.0 kB view hashes)

Uploaded Python 2 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