URL: https://linuxfr.org/users/freestyle/journaux/code-as-art-poeme-bouddhiste-auto-generatif-en-python Title: code as art : poème bouddhiste auto-génératif en python Authors: freestyle Date: 2019年08月10日T01:24:16+02:00 License: CC By-SA Tags: bouddhiste, poème, python, code et art Score: 2 Comme je suis en train de redécouvrir les snippets qui m'ont amusés, marquée etc. Je ne resiste pas à vous partager le poème bouddhiste auto-génératif en python développer en tant que code as art en 2007 source : https://honestpoet.wordpress.com/2007/12/23/worlds-first-poem-written-in-python/ Ps : le poème ne fonctionne plus chez moi , je dois dire que cela fait longtemps que je n'ai plus fais du python , quelqu'un sait pourquoi ? ```bash python poem.py Traceback (most recent call last): File "poem.py", line 4, in myinnards=open('wiseremembrances.py','r') IOError: [Errno 2] No such file or directory: 'wiseremembrances.py' ``` Citation : ``` # This poem was generated from Python 2.5 using a series of list object operations. # All output (including the output authoring it's own source code) # was sent to the textfile using a virtual compiler during runtime. Wise Remembrances I am not the things I have. I am not the people I love. I am not the labors I do. I am not the perceptions I experience. I am not the thoughts I think. I am not the emotions I feel. I am not the rules I follow. But in this moment . . . The rules I follow become me. The emotions I feel become me. The thoughts I think become me. The perceptions I experience become me. The labors I do become me. The people I love become me. The things I have become me. Rules I follow. Perceptions I experience. Thoughts I think. Labors I do. Things I have. People I love. Emotions I feel. But I will be unhappy if I forget . . . I am not the things I have. I am not the people I love. I am not the labors I do. I am not the perceptions I experience. I am not the thoughts I think. I am not the emotions I feel. I am not the rules I follow. # Like any good poet, I bare my own innards below: ``` ```python import random, sys fileout=open('Wise_remembrances.txt','w') myinnards=open('wiseremembrances.py','r') myinnards_exposed=myinnards.read() sys.stdout=fileout print '# This poem was generated from Python 2.5 using a series of list object operations.' print '# All output (including the output authoring it\'s own source code)' print '# was sent to the textfile using a virtual compiler during runtime.\n' print '\n\nWise Remembrances\n\n' global itemcounter objectlist=[ 'the things I have', 'the people I love', 'the labors I do', 'the perceptions I experience', 'the thoughts I think', 'the emotions I feel', 'the rules I follow'] itemcounter=0 def denunciation(objectlist,itemcounter,grade): for item in objectlist: print itemcounter*'\t'+'I am not '+item+'.\n', itemcounter+=grade return itemcounter def repunct(objectlist): for index in range(0,len(objectlist)): objectlist[index]=objectlist[index][0].swapcase()+objectlist[index][1:] itemcounter=denunciation(objectlist,itemcounter,1) objectlist.reverse() print '\n'+itemcounter*'\t'+'But in this moment . . .\n' repunct(objectlist) for item in objectlist: itemcounter-=1 print itemcounter*'\t'+item+' become me.' copylist=[] for item in objectlist: copylist.append(item) random.shuffle(copylist) newlist=[] for item in copylist: newlist.append(item[4].upper()+item[5:]+'.') for item in newlist: print '\n',itemcounter*'\t',item, itemcounter+=1 print '\n\n'+itemcounter*'\t'+'But I will be unhappy if I forget . . .\n' objectlist.reverse() repunct(objectlist) itemcounter=denunciation(objectlist,itemcounter,-1) print '\n\n# Like any good poet, I bare my own innards below:\n\n' print myinnards_exposed # This is software that composes a Buddhist sutra "renunciation poem" "on-the-fly". # It further displays it's own source code as above. If you run the code above in a Python compiler, # you will get a different, but similarly-ruled poem. Interestingly, the Artificial Intelligent "author" # reflects on her own process at the end of the poem by displaying her own innards (Including this commentary).

AltStyle によって変換されたページ (->オリジナル) /