Skip to content

apg/python-worlds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 

Repository files navigation

Worlds for Python

A hack attempt at making Alessandro Warth's Worlds 
(www.vpri.org/pdf/rn2008001_worlds.pdf) in Python.

if __name__ == '__main__':
    with Universe():
        thisWorld.bigfat = True
        thisWorld.coward = False

        new = thisWorld.sprout()
        new.coward = True
        print 'new == thisWorld?', new == thisWorld

        with new.sprout():
            thisWorld.never_defined = "this should raise a NameError later"

        print 'coward yet in this world?', thisWorld.coward
        new.commit()
        thisWorld.commit()

    print "Is bigfat (%s)and coward (%s)?" % (bigfat, coward)
    
    print "NameError raised here, since never_defined was never committed to the world with no parent (the one introduced by the Universe)", never_defined


Prints out:

new == thisWorld? False
coward yet in this world? False
Is bigfat (True)and coward (True)?
NameError raised here, since never_defined was never committed to the world with no parent (the one introduced by the Universe)
Traceback (most recent call last):
  File "worlds.py", line 132, in <module>
    print "NameError raised here, since never_defined was never committed to the world with no parent (the one introduced by the Universe)", never_defined
NameError: name 'never_defined' is not defined

About

A hack attempt at building Alessandro Warth's Worlds in Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages