Top

pyMez.Code.Utils.Types module

Types contains type definitions to fix python 2->3 migration issues

Help

pyMez.Code.Utils

Documentation Home | API Documentation Home | Examples Home | Index

#-----------------------------------------------------------------------------
# Name:        PerformanceUtils
# Purpose:     To create tools for testing performance
# Author:      Aric Sanders
# Created:     8/18/2016
# License:     MIT License
#-----------------------------------------------------------------------------
""" Types contains type definitions to fix python 2->3 migration issues

   Help
---------------
<a href="./index.html">`pyMez.Code.Utils`</a>
<div>
<a href="../../../pyMez_Documentation.html">Documentation Home</a> |
<a href="../../index.html">API Documentation Home</a> |
<a href="../../../Examples/html/Examples_Home.html">Examples Home</a> |
<a href="../../../Reference_Index.html">Index</a>
</div>"""

#-----------------------------------------------------------------------------
# Standard Imports

#-----------------------------------------------------------------------------
# Third Party Imports

#-----------------------------------------------------------------------------
# Module Constants
StringType=str
ListType=list
IntType=int
FloatType=float
ComplexType=complex
LongType=float
DictionaryType=dict
type_names=["StringType","ListType","IntType","FloatType","ComplexType","LongType","DictionaryType"]
#-----------------------------------------------------------------------------
# Module Functions

#-----------------------------------------------------------------------------
# Module Classes

#-----------------------------------------------------------------------------
# Module Scripts

#-----------------------------------------------------------------------------
# Module Runner
if __name__ == '__main__':
    for index,type in enumerate([StringType,ListType,IntType,FloatType,ComplexType,LongType,DictionaryType]):

        print("The types defined here are {0} : {1}".format(type_names[index],type))

Classes

class ComplexType

Create a complex number from a real part and an optional imaginary part.

This is equivalent to (real + imag*1j) where imag defaults to 0.

Ancestors (in MRO)

Class variables

var imag

var real

class DictionaryType

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors (in MRO)

class FloatType

Convert a string or number to a floating point number, if possible.

Ancestors (in MRO)

Class variables

var imag

var real

class IntType

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

Ancestors (in MRO)

Class variables

var denominator

var imag

var numerator

var real

class ListType

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

Ancestors (in MRO)

class LongType

Convert a string or number to a floating point number, if possible.

Ancestors (in MRO)

Class variables

var imag

Inheritance: LongType.imag

var real

class StringType

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

Ancestors (in MRO)

Module variables

var type_names