This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

install

$ pip install typedtuple

basic definition

from typedtuple import typedtuple

# definition dictionary is converted to voluptuous.Schema(definition_dict, required=True)
Vector = typedtuple('Vector', {'x': float, 'y': float, 'z': float})
v0 = Vector(x=10.0, y=20.0, z=30.0)
print v0.x  # 10.0
v1 = Vector(x=10, y=20)  # raises exception

using voluptuous schema

from voluptuous import Schema

# can use voluptuous.Schema as definition
Vector = typedtuple('Vector', Schema({'x': float, 'y': float, 'z': float}, required=True))

using @schema decorator

from math import sqrt
from typedtuple import schema

@schema({'x': float, 'y': float, 'z': float})
class Vector(object):
    @property
    def length(self):
        return sqrt(pow(self.x, 2.0) + pow(self.y, 2.0) + pow(self.z, 2.0))

v = Vector(x=1.0, y=2.0, z=2.0)
print v.length  # 3.0

using voluptuous functions

from voluptuous import Coerce
from typedtuple import schema

@schema({'x': Coerce(float), 'y': Coerce(float)})
class Vector(object):
    pass

v0 = Vector(x=10, y='20.0')
print v0.x  # 10.0
print v0.y  # 20.0

using OrderedDict

from collections import OrderedDict
from typedtuple import schema

@schema(OrderedDict((('x', float), ('y', float), ('z', float))))
class Vector(object):
    pass

print Vector._fields  # ('x', 'y', 'z')

caveat

TypedTuple is tuple. so…

from collections import OrderedDict
from typedtuple import typedtuple

Vector0 = typedtuple('Vector0', OrderedDict((('x', float), ('y', float))))
Vector1 = typedtuple('Vector1', OrderedDict((('y', float), ('x', float))))

v0 = Vector0(x=10.0, y=20.0)
v1 = Vector1(x=20.0, y=10.0)
v0 == v1  # True

TODO

use nose for test

benchmark

Release History

Release History

0.1.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
typedtuple-0.1.0.tar.gz (2.4 kB) Copy SHA256 Checksum SHA256 Source Dec 28, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting