My favorites | Sign in
Project Logo
                
Show all Featured downloads:
bartleby-0.1a.zip
Show all Featured wiki pages:
Bartleby
Feeds:
People details
Project owners:
  si...@ionous.net

experimental type safety for python

the name refers to the herman melville short story: this code would 'prefer not to' run when unexpected types are passed around.

it's similar to the excellent typecheck module, but bartleby tries to:

see the wiki for details

quick examples

@checkparams
def example( x=Type(str) ):
 return x
    
example("hello") # success!
example(5)       # assert: 'int' isn't type 'str'
example()        # assert: missing required parameter x
    

class Example(typedobject):
 name= Type(str, "default")

e= Example()
print e.name       # prints *instance* variable: "default"
e.name= "bartleby" # success!
e.name= 5          # assert: 'int' isn't type 'str'








Hosted by Google Code