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

complex(real[, imag]) -> complex number

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

float(x) -> floating point number

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=0) -> int or long int(x, base=10) -> int or long

Convert a number or string to an integer, or return 0 if no arguments are given. If x is floating point, the conversion truncates towards zero. If x is outside the integer range, the function returns a long instead.

If x is not a number or if base is given, then x must be a string or Unicode object 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

list() -> new empty list list(iterable) -> new list initialized from iterable's items

Ancestors (in MRO)

class LongType

float(x) -> floating point number

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

Ancestors (in MRO)

Class variables

var imag

Inheritance: FloatType.imag

var real

Inheritance: FloatType.real

class StringType

str(object='') -> string

Return a nice string representation of the object. If the argument is a string, the return value is the same object.

Ancestors (in MRO)

  • StringType
  • __builtin__.basestring
  • __builtin__.object

Module variables

var type_names