ize overview

book | ize | ize v1.0.1

Ize is a python module providing a set of function decorators.

The main functionalities that it offers are :

  • operator support for functions
  • type checking
  • customisable trace
  • partial call of function (as the haskell curry)
  • decorators and metaclass supports

Decorators helpers allow to "post-decorate" whole modules or functions sets, so that type checking and traces (for exemple) can be be easily disabled, removed (to export) or added to extern module.

Download now !

lightMixer-1-0-0.py

files | LightMixer v1.0.0 | script
Copy it into your .blender/script directory.

LightMixer Demo - flash

LightMixer v1.0.0 | swf | tutorial
Video demo of the LightMixer Script. This script allows quick light manipulation and grouping. This file must be opened with your favorite explorer.

Ize v1.0.1 - tar.gz

ize v1.0.1 | pdf | script
Full distribution. include manual.

Ize v1.0.1 - zip

ize v1.0.1 | script | zip

Just the package. Must be dezipped into your site-package directory.
Click to Download below.

Ize v1.0.1 - Manual - pdf

book | ize v1.0.1 | pdf

External declaration

ize v1.0.1 | typechecker

In addition to docstring type checking that can be used individually with @tize or mass decorator", external string can also be used. In that case, the name of the type declaration will be used .For that we have two functions :

  • post_checkize(types, dico)
    Apply types declaration to member of dico. This can be usefull if you want to separate the types declaration from the code, as header in c++) or to export code without typechecker

foo.py:

def add(x, y): return x+y def mul(x,y): return x*y

Tize

decorator | ize v1.0.1 | typechecker

The tize decorator provides powerfull typechecking using docstring using a syntax similar to haskell syntax.

Each line of the docstring is threated as a potential type declaration. Lines that can't be parsed are simply ignored.
Multiples type declarations are combined within a OR disjonction, i.e. the function must only verify one line at a given time.

Type declaration must of the form :

[ name] '::' [ arguments ] [ '->' | '=>' return]

  • name is not used and is here only for doc conveniance.
  • arguments is the type of each argument of the function.

Typechecker

ize v1.0.1 | module | typechecker

The typecheker modules provides a powerfull in-docstring typeching facility. By typechecking we mean verification of the type of arguments and returned object og functions.
At the moment, typechecher is a front end of typecheck using tpg as parser. You must have these modules installed to be able to use typechecker.

Need of typechecking

One of the most advantage of python is that it's a typeless langage. It's interesting because it allows to write code faster - you don't need to declare type - but in many cases debugging is harder - you don't know the exact source of error. So, if for very small project, typeless langage is faster, for bigger project, typechecking could be very usefull by reducing debugging time.

Tracer class

class | ize v1.0.1

The basic Tracer is the base class for tracer. It owns a formater and do nothing. It must be derived. PrintTracer and StackedTracer are Tracer.

  • formater a formater. Initialy a TraceFormatter
  • format_call(self,__f__, a, k)
    Call formater.format_call.
  • format_return(self,__f__, a, k, returned)
    Call formater.format_retrun.
  • enter(self,__f__, a, k)
    Call at function entry. Do nothing.
  • exit(self,__f__, a, k, r)
    Call at function exit. Do nothing.